Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
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: 5812
    
    7

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: 37923
    
  22
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

 
Don't get me started about those stupid light bulbs.
 
subject: Can you help me get this file compiled?
 
Similar Threads
Error in Servlet compilation
Pakage does not exist
HFSJ: Can't compile second version of BeerSelect.java
Compile problem
Command line arguments