• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

My classpath doesn't stay upon reboot

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My CLASSPATH doesn't stay upon restarting my computer. As a result, if I don't set it again, I will have compilation errors in MSDOS.

Since I'm using servlets, I set my classpath as...
"set CLASSPATH=c:\j2sdk1.4.2_03\lib\servlet.jar". Is there something wrong?

I read in some book, the classpath was set to the JRE in Program Files/java

How can I make my classpath stay permanent?

Has it something to do with the environment variables in Control Panel>System?
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
JulianInactive KennedyInactive
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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)

 
JulianInactive KennedyInactive
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Jules
[ September 05, 2004: Message edited by: Julian Kennedy ]
 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like this?

 
JulianInactive KennedyInactive
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic