File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes setting classpath, tomcat 5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "setting classpath, tomcat 5" Watch "setting classpath, tomcat 5" New topic

setting classpath, tomcat 5

Michael Sullivan
Ranch Hand

Joined: Dec 26, 2003
Posts: 235
as many of you may have once experienced, I'm getting errors when trying to import javax.servlet.* and such. My current classpath settings are:
.;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar; C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\jsp-api.jar
as specified by:
but, alas it still doesn't seem to be correct. The example servlets installed with Tomcat work fine, when I try to compile simple servelts, I get errors in the import, package javax.servlet does not exist.

Anyone been through this before, care to point me in the correct direction?
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
From the page you reference Note that this all goes on one line with no spaces--it is broken here only for readability
I'm slightly worried by the space in your classpath. Have you tried it woth no spaces?
If that's note the problem, have you double checked that the appropriate jar files really are where you have said.
Finally, did you quit and restart the command window after changing the CLASSPATH? - try

to see what it thinks it is

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Michael Sullivan
Ranch Hand

Joined: Dec 26, 2003
Posts: 235
I removed the space, with no effect. The packages are in fact where I specify them. Interestingly enough, echo %CLASSPATH% returns:
so something is wrong, perhaps the system does not recognize the classpath as I have defined it?
Michael Sullivan
Ranch Hand

Joined: Dec 26, 2003
Posts: 235
Thanks for your responses. I ended up just deleting the CLASSPATH, and recreating it. After that, it seemed to work just fine. No explanation, just one of those strange windows quirks I guess. Thanks for the assist.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13035
For serious work with servlets, I recommend using ANT - once you get over the learning curve you never have to mess with CLASSPATH in the environment variables again.
Michael Sullivan
Ranch Hand

Joined: Dec 26, 2003
Posts: 235
yes, but for now... for the basic learning curve... ant will only confuse the matter. Later, Ant will come into play.
I agree. Here's the link:
subject: setting classpath, tomcat 5
It's not a secret anymore!