Java Programming Tutorial Index

Java Environment Setup

Path and Classpath look similar but is a big difference between them.



What is Path in Java?

Once you installed Java on your machine, it is required to Set the PATH environment variable to conveniently run the executable (javac.exe, java.exe, javadoc.exe, and so on) from any directory without having to type the full path of the command, such as:

C:\javac TestClass.java

Otherwise, you need to specify the full path every time you run it, such as:

C:\Java\jdk1.7.0\bin\javac TestClass.java

What is Classpath?

Classpath is system environment variable used by the Java compiler and JVM.
Java compiler and JVM is used Classpath to determine the location of required class files.

C:\Program Files\Java\jdk1.6.0\bin

See Java installation to know more about How to set the path in Windows and Linux.

Difference between path and classpath

path classpath
path variable is used to set the path for all Java software tools like javac.exe, java.exe, javadoc.exe, and so on. classpath variable is used to set the path for java classes.

difference between path and classpath



Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram