• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Package problem in walkthrough

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per Seetharaman Venkatasamy's suggestion, I'm starting a new thread with my question from the Regarding Package thread.

I'm going through the walkthrough in Chapter 3 of Head First Servlets & JSP. It works up to a point (and I can work around that point), but it looks like I should not have to.

The following works:

Directory structure:
C:\Java\HF\bV1\src\com\example\model
C:\Java\HF\bV1\src\com\example\web

From C:\Java\HF\bV1\src:

javac com\example\model\BE.java
javac com\example\web\BS.java
java com.example.model.BE

And this works:

From C:\Java\HF\bV1:

javac -classpath "C:\Program Files\Apache Software Foundation\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar";classes:. -d classes src\com\example\model\BE.java

But this does not, yielding "package com.example.model does not exist" (and note that without the import statement it DOES work):

javac -classpath "C:\Program Files\Apache Software Foundation\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar";classes:. -d classes src\com\example\web\BS.java

I can get the sample to run if I compile locally and then manually deploy the resulting class file, but it doesn't appear that should be necessary.

What am I doing wrong?
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic