Tutorials

Java Basics


Path vs Classpath


Both path and classpath is system environment variable.

Here we are going to see the major difference between both path and classpath in java.

 

Path vs Classpath in java

PATH

CLASSPATH

Path helps to find JDK binaries so that javac and java command can be used compile and run java program.

Classpath helps class loader to search and load the .class file comprising of bytecode.

To set path, include JDK_Home/bin directory in path system environment variable.

To set classpath, include all the directories where the .class files or JAR files required to run the java application is stored.

Path is used by operating systems to find the JDK binaries.

Classpath is used only by java class loader to load the .class files

 



Please Share this page
Views : 271
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!