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


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Setting CLASSPATH" Watch "Setting CLASSPATH" New topic
Author

Setting CLASSPATH

Mark Mokris
Ranch Hand

Joined: May 08, 2002
Posts: 61
Why do need to always set the CLASSPATH even through I am just working with one class in one directory, and that class is in my current directory?
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Are you always setting it using the
java -classpath ... method? If so you are only
setting it for a particular run of the JVM. You
can set you system's CLASSPATH variable so you
don't have to do this all the time.
For Windows 98(maybe 95 and ME too):
Start Menu>Run...>type in msconfig
Click on the autoexec.bat tab
Editthe text SET CLASSPATH=C:\PROGRA~1\JAVA\J2RE1.4.1_01\lib\rt.jar (or something close
at the end of this, put a ; (semicolon) and either type in the full path to where the .class is located OR type in a . (period)

For Windows 2000/XP:
Start Menu>Settings>Control Panel
System
Advanced Tab
Environment Variables
Find the CLASSPATH variable and edit as above
DOn't know about any other OS


Steve
 
Don't get me started about those stupid light bulbs.
 
subject: Setting CLASSPATH