Search

Difference between PATH and CLASSPATH



Difference between PATH and CLASSPATH

Hello friends; today we will discuss about difference between path and classpath in java. Path variable is set for all the tools like java, javac, javap, javah, jar, appletviewer etc. and classpath is set for provides path for all predefined class in java.

difference between path and classpath in java

Set Path

“C:\Program Files\Java\jdk1.6.0\bin”
All the tools are present in bin folder so we set path upto bin folder

Classpath variable is used for all the classes which is used in our program so we set classpath upto rj.jar. in rt.jar file all the .class files are present. When we decompressed rt.jar file we get all the .class files.

Set ClassPath

“C:\Program Files\Java\jre1.6.0\lib\rt.jar”
Here rt.jar is a jar file where all the .class files are present so we set the classpath upto rt.jar.