This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Can you help me get this file compiled? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Can you help me get this file compiled?" Watch "Can you help me get this file compiled?" New topic
Author

Can you help me get this file compiled?

Suresh Ramanan
Greenhorn

Joined: Feb 08, 2009
Posts: 27
Hi!

I am working with Head First Servlets and JSP.
I;m in the Mini MVC tutorial chapter.
When i compile the model CoffeeExpert.java, its all fine.
But when i compile the CoffeeSelect.java, it reports that the package com.example.model (one in which the CoffeeExpert is present) is unavailable

These are the command prompt reports when i compile the CoffeeSelect.java
(And i have included the import statement for CoffeeExpert in CoffeeSelect.java)
Can you please help me crack this?

D:\Program Files\Jsp and Servlets\coffeeV1>javac -classpath /"D:\Program Files\apache-tomcat-5.5.26\common\lib\serv
let-api.jar" -d classes src/com/example/web/CoffeeSelect.java
src\com\example\web\CoffeeSelect.java:8: package com.example.model does not exist
import com.example.model.*;
^
src\com\example\web\CoffeeSelect.java:19: cannot find symbol
symbol : class CoffeeExpert
location: class com.example.web.CoffeeSelect
CoffeeExpert ce = new CoffeeExpert();
^
src\com\example\web\CoffeeSelect.java:19: cannot find symbol
symbol : class CoffeeExpert
location: class com.example.web.CoffeeSelect
CoffeeExpert ce = new CoffeeExpert();
^
3 errors

and i'm working with jdk 1.6

thanks a bunch

[edit]Take colour tags out. CR[/edit]


SCJP 5.0 SCWCD 1.5 SCWCD Hall of Fame
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5536

The Java compiler needs to know about all of the classes; you can do this by supplying them on the command line:

javac ... src/com/example/web/CoffeeSelect.java src/com/example/model/CoffeeExpert.java

or like this:

javac ... src/com/example/web/*.java src/com/example/model/*.java

JBoss In Action
Suresh Ramanan
Greenhorn

Joined: Feb 08, 2009
Posts: 27
Hi Peter Johnson!!!

wow!!!

Thanks a lot.
The classes got compiled now...
Thanks a bunch...
Hurray! I can proceed with the tutorial now

Best wishes,
Suresh
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32689
    
    4
Welcome to JavaRanch

I have had to change the red writing in your 1st post to black; it was difficult to read.
Suresh Ramanan
Greenhorn

Joined: Feb 08, 2009
Posts: 27
@Campbell Ritchie

Hi!

Thanks for the welcome note.
Sorry i didn't mean to get the text very flashy
I just made it red for emphasis

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Can you help me get this file compiled?
 
Similar Threads
HFSJ: Can't compile second version of BeerSelect.java
Error in Servlet compilation
Compile problem
Command line arguments
Pakage does not exist