aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes problem in HFSJ chapter 3 Beer example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "problem in HFSJ chapter 3 Beer example" Watch "problem in HFSJ chapter 3 Beer example" New topic
Author

problem in HFSJ chapter 3 Beer example

Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
Hi all,

This is kind of silly however i am not sure why i am getting an compile time error here...i am posting in this forum because the example i amdoing is from HFSJ chapter 3 BeerSelection...

while compiling BeerSelect.java i am getting the following error...

package import com.example.model does not exist

import com.example.model.*;

i have stored the BeerExpert.java file in com/example/model folder...and has been compiled and stored to com/example/model folder under classes folder.....

Have i missed some silly thing?

Please let me know if you need any more inputs...


Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
Dhananjay Inamdar
Ranch Hand

Joined: Jan 27, 2003
Posts: 130
Hi Atul,

What is this



package import com.example.model does not exist



it should be either package or import.


Just like you, struggeling to get the right solutions!<br /> <br />Sun Certified Java Programmer 1.5<br /> <br />Target - SCWCD
Balaji Londhe
Ranch Hand

Joined: May 02, 2006
Posts: 100
Make sure that your Web-inf is named so. Case matters.
Second thing you can check is if your class contains package statement at it's top.


Attitude matters the Altitude.
Jeyalakshmi Palaniyandi
Greenhorn

Joined: Aug 10, 2005
Posts: 13
hi Atul Sawant,
i have also got the same error. use the following compilation options
javac -classpath classes;C:\tomcat\common\lib\servlet-api.jar -d classes src\com\example\web\your java file


this one is what we use for compilation
javac -classpath C:\tomcat\common\lib\servlet-api.jar -d classes src\com\example\web\your java file


see the difference
Jeyalakshmi Palaniyandi
Greenhorn

Joined: Aug 10, 2005
Posts: 13
i think this will help to solve your problem
Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
Thanks for replying guys!

I had included the package name com.example.model in the BeerExpert and also imported the package as com.exaple.model.

command line as said above i had followed the same...

javac -classpath d:/tomcat/common/lib/servlet-api.jar -d classes src/com/example/web/BeerSelect.java

resulting.....

package com.example.model does not exist....

i am working on development environment right now...

please help.
Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
anyone please?
Mark Garland
Ranch Hand

Joined: Nov 11, 2006
Posts: 226
Atul,

What OS are you using?

I'm using Windows, and my compile String was:

javac -classpath "C:\Program Files\Apache Software Foundation\Tomcat 5.5"\common\lib\servlet-api.jar;classes -d classes src\com\example\web\BeerSelect.java

(My slashes seem to be the other way round to yours. Might help?).


28/06/06 - SCJP - 69%, 05/06/07 - SCWCD - 92%, 28/02/08 - IBM DB2 v9 Fundamentals (Exam 730) - 87%, 18/11/08 - IBM DB2 v9 DBA (Exam 731) - 89%, 26/02/11 - SCBCD - 88%
Mark Garland
Ranch Hand

Joined: Nov 11, 2006
Posts: 226
Just ran the following and it all worked ok...

satya mahapatra
Ranch Hand

Joined: Jan 07, 2006
Posts: 134
Hi. I think you have to add that class in classpath environment variables.
Like you must have added tools.jar in your classpath environment variable.
And thats why when you are importing all the java calsses like java.util,
java.math etc the system knows where to pick all thjese calsses. Like that yours is also an import statement and if I am not wrong you need to add this package path into your classpath system environment variable.

Just try this it may solve your problem.


Regards,<br />Satya<br />SCJP,SCWCD
Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
I am late at my own party!

Thanks guys...i will try all your answers. Priya Viswam emailed me a solution (such a nice lady!) Shamefully did not find time to try it out till now.

Thanks guys! you rock!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in HFSJ chapter 3 Beer example