The answer is yes, if you create a new (User or System) environment variable called CLASSPATH via Control Panel and set it to your classpath it will persist when you reboot. You can also set it in autoexec.bat.

But remember - Tomcat does not pay any attention to the environment CLASSPATH value. See the classloader how-to documentation installed with Tomcat. Bill

Parka Teoh
Ranch Hand

Joined: Aug 28, 2004
Posts: 40

posted Sep 05, 2004 02:07:00

0

Originally posted by Julian Kennedy: Why not try it, dude? You fixed your other problem yourself!

The answer is yes, if you create a new (User or System) environment variable called CLASSPATH via Control Panel and set it to your classpath it will persist when you reboot. You can also set it in autoexec.bat.

Jules

Am I doing it right here? It still doesn't work after I reboot. I'm also not good at the autoexec.bat

Parka Teoh
Ranch Hand

Joined: Aug 28, 2004
Posts: 40

posted Sep 05, 2004 02:21:00

0

Originally posted by William Brogden: But remember - Tomcat does not pay any attention to the environment CLASSPATH value. See the classloader how-to documentation installed with Tomcat. Bill

Is this a problem caused by Tomcat? I mean, with the servlet packages, even without Tomcat, I should be able to compile my classes, right?

Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823

posted Sep 05, 2004 03:27:00

0

Hi Parka,

You appear to be doing it in the right place but it doesn't look like you're setting CLASSPATH correctly. If I just want to compile a servlet for Tomcat 5 in a Windows command window (MSDOS, if you like) then I'd set my classpath as follows:

That's because my Tomcat 5 installation comes with the Netbeans IDE. You should use the path to common\lib\servlet-api.jar in your installation (note you're missing .jar in your example - that won't help). You don't need any other files or directories (unless they're other JARs you're actually using). You don't need to move or copy the JAR files from where they're installed (it looks like you have done).

Bill's note applies when running your code in Tomcat. When running your JARs should typically be in one of the common lib directories or in the lib directory specific to the web app (i.e. under WEB-INF\lib). You don't need to worry about the servlets JAR in this respect however as it's set up at installation.

As you suspect, you can compile servlets independently of Tomcat or any other web container, provided that you have the JAR file.

Hope that helps.

Jules

Parka Teoh
Ranch Hand

Joined: Aug 28, 2004
Posts: 40

posted Sep 05, 2004 06:43:00

0

Originally posted by Julian Kennedy: Hi Parka,

You appear to be doing it in the right place but it doesn't look like you're setting CLASSPATH correctly. If I just want to compile a servlet for Tomcat 5 in a Windows command window (MSDOS, if you like) then I'd set my classpath as follows:

. . .

Thanks!! It works now. I can see how close yet how far I am.

My Tomcat 5 doesn't come with NetBeans. (maybe I just haven't found it)

Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823

posted Sep 05, 2004 07:13:00

0

Glad it works. By the way, it's Netbeans that comes with Tomcat, not Tomcat that comes with Netbeans. [Edit: What I mean to say is that the Netbeans 3.6 installation includes Tomcat 5. A Tomcat installation would not include Netbeans] Don't forget to include the ".;" at the beginning of your CLASSPATH ("." is the current directory). You'll need it if you want to compile more than one source file in the same directory.