Harikrishna Gorrepati wrote:Hi,
I am getting confused between PATH and CLASSPATH. Here is my understanding
The PATH variable contains directories where binary files are located [ C:\Program Files\Java\jdk1.6.0_07\bin; ]
The CLASSPATH contains directories (or JAR files) [ C:\Program Files\Java\jdk1.6.0_07\lib; ]
So, Why should I use CLASSPATH eventhough I am able to run programs ?
Harikrishna Gorrepati wrote:The CLASSPATH contains directories (or JAR files) [ C:\Program Files\Java\jdk1.6.0_07\lib; ]
Campbell Ritchie wrote:As JV said, you should not set a system CLASSPATH at all. If it is already set, add .; to its beginning. If it isn’t already set, creating a new CLASSPATH usually does more harm than good.
Harikrishna Gorrepati wrote:I want to see an example work with classpath and example doesn't work without classpath. Can anyone provide couple of examples for this. Thank you for your help !!
fred rosenberger wrote:PATH is used by the OS to find executables to run.
CLASSPATH is used by the JVM to find class files to run.
So, the OS uses the PATH variable to find the java executable, which then in turn uses the CLASSPATH to find the class files to run.
Note that you don't actually have to set either one. They are both a convenience that allow you to type less.