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

[/box]

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 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 🙂