Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

path and classpath

 
sandeep MITTAL
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
rahul V kumar
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic