File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

package does not exist error

Tom Gibson

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

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\

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

Joined: Aug 05, 2005
Posts: 3742
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.


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

Tom Gibson

Joined: Apr 24, 2007
Posts: 3
Thanks Joanne -- it works now
I agree. Here's the link:
subject: package does not exist error
jQuery in Action, 3rd edition