Java

Difference between Path vs Classpath in Java

In this tutorial, we are going to understand Path vs ClassPath in Java.

Java Path :

Path represents the location, where required java binary executables are available.

Setting path :

Set path = C:\program Files\java\Jdk\bin

By passing the above command on command prompt, we can set the path for java.

If we do not set the path correctly, the java commands (java,javac,jar) will not execute.

Class Path :

Class path describes the location, where the required .class files are available. Java compiler and JVM will use class path to locate require .class files.

If we do not set the class path correctly, out program may not compile and may not run.

Happy Learning :)

Found a mistake or something out of date? Tell us →

Written by

chandrashekhar

Founder of onlinetutorialspoint.com. Enterprise architect with 15+ years in healthcare technology, designing and running systems on AWS and Azure. Writes about building real things with AI, local AI hardware and cloud certifications.

Keep reading

Ask a question or leave a comment