Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HeadFirst .. chapter 3 totally stumped..:(

 
Brian Percival
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been breaking my head over this for the last 2 hrs.

I am trying out the examples in chapter 3 (beer advice example). For some reason, while trying to compile the version2 of BeerSelect.java the "import com.example.model.*;" fails. I tried everything but just wouldn't work. What could be the problem?

When I compile the BeerExpert.java in src/com/example/model, it works fine and corresponding dir structure is created properly in classes dir. But in src/com/example/web, the package is not visible.

Can anyone suggest what I am missing?

I used a test file to test the import, placed the test file in com/example/web/ and when I compiled WITHOUG "-classpath tomcathome/common/lib/servlet-api.jar" option it works fine. Issue apparently is only when using the classpath option.

regards,
Brian
[ May 16, 2005: Message edited by: Brian Percival ]
 
Jamed
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to include the path to all your classes for that project.

for example this is what i had to do for it to work:

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

as you can see, i've included the path to my class files for this project which is D:\MyProjects\BeerV1\classes

the BeerSelect.java needs the model.class in order to complie correctly, and thats how it finds it cuase it's in D:\MyProjects\BeerV1\classes

hope this helps
 
Nebiyu Haileselassie
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This helped me too. thanks
 
joko mujoko
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really recommended to use Ant tto develop web app for preparing SCWCD. Yu have to be focuse in JSP and servlet, be the Container not Compiler

Regard
Joko
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, a little build.xml wil save you some time afterwards. Once you've made one, you can use it for all your web apps. It's useful to build war files and deploy to the container's web application directory in one shot.
 
cheenu Dev
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by joko mujoko:
I really recommended to use Ant tto develop web app for preparing SCWCD. Yu have to be focuse in JSP and servlet, be the Container not Compiler

Regard
Joko


whats ant n where t download from...
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ANT
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic