wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes package does not exist error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package does not exist error" Watch "package does not exist error" New topic
Author

package does not exist error

Tom Gibson
Greenhorn

Joined: Apr 24, 2007
Posts: 3
I'm trying to work through the first servlet example in the the Head First Servlets & JSP book.

I am running Apache Tomcat 5.5.23 Server. The path to tomcat is C:\tomcat

Per the example in the book, I created the following
C:\MyProjects\beerV1\src\com\example\web\BeerSelect.java
C:\MyProjects\beerV1\web\form.html
C:\MyProjects\beerV1\etc\web.xml

When I try to compile my class by using:

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

I get an error in my DOS window saying "package javax.servlet does not exist."

I'm not sure what I am doing wrong. Am I right in thinking that the package is not being found because the -classpath in my command is somehow wrong? I can see the jar at C:\tomcat\common\lib\servlet-api.jar but it doesn't seem to found in the above line. Please help. Let me know if I need to provide any other information. Thanks!
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3739
    
  16
The classpath separator on Windows is ; rather than : and you've missed a separator after classes. Change

-classpath C:\tomcat\common\lib\servlet-api.jar:classes.

to

-classpath C:\tomcat\common\lib\servlet-api.jar;classes;.


Joanne
Tom Gibson
Greenhorn

Joined: Apr 24, 2007
Posts: 3
Thanks Joanne -- it works now
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package does not exist error