File APIs for Java Developers Manipulate DOC, XLS, PPT, PDF and many others from your application. http://aspose.com/file-tools
Big Moose Saloon
 Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login

# 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: http://www.coreservlets.com/Apache-Tomcat-Tutorial/#Set-CLASSPATH
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?
Thanks!
Frank Carver
Sheriff

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

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:
%CLASSPATH%
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
Frank,
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.
Michael
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12782

5
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.
Bill
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: http://aspose.com/file-tools

subject: setting classpath, tomcat 5