aspose file tools*
The moose likes Beginning Java and the fly likes path and classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "path and classpath " Watch "path and classpath " New topic
Author

path and classpath

sandeep MITTAL
Greenhorn

Joined: Oct 14, 2004
Posts: 3
can anybody help me what is the basic difference between setting path and classpath how can i set path and classpath in windows xp permanently
please help me
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Path tells the OS where to look for executables. So if you want to open a command window to any directory and say "Java -version" you need the path to include the jre\bin directory.

Classpath tells the JVM where to look for classes. When I use classes in the JUnit.jar I have to make sure the classpath includes the JUnit.jar.

You can set either or both in the Control Panel - Start / Settings / Control Panel / System / Advanced Tab / Enviroinment Variables button.

For my own little Java programs I often make bat files to start them up. Then I can modify path & classpath right before running the program. You can override classpath iwth the -cp switch on the Java command.

Try some simple programs to see how this works ... holler again if that's not enough detail. Cheers!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
rahul V kumar
Ranch Hand

Joined: May 20, 2003
Posts: 82
The PATH environment variable is typically something that the operating system uses to find executable files.

The CLASSPATH environment variable is typically something that implementations of the Java Virtual Machine (JVM) use to find Java class files. Examples are classes12.zip etc.,

To set the variables permanently on XP

Go to your control panel -> Performance and maintainence -> System

When a window opens up go to advanced -> Environment variables
Under System variables you will find PATH.

Add your jdk bin directory to it.

save your settings and you should be ready to go.

Good luck.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: path and classpath