Java Path and Classpath Setting in Windows 7

Learn how to set java path and classpath in windows 7/8/10 or how to set path in java in windows 10 or how to set java path in windows 8 or how to set java path in Linux or java path windows or how to check java path in windows using cmd or set path windows 10 or set path command line or set path windows 7.


set path java in windows 7


You need to set PATH to compile Java source code and create Java class files. JDK bin directory contains javac and java commands to compile and run Java programs. CLASSPATH is little different than Path and it's used by JVM rather than Operating System to load classes at runtime.

The path is required to be set for using tools such as javac, java etc.If you are saving the java source file inside the JDK/bin directory, the path is not required to be set because all the tools will be available in the current directory.But If you are having your java file outside the JDK/bin folder, it is necessary to set the path of JDK.


How to Set Java Path in Windows 7
Go to My Computer properties → advanced tab →; environment variables → new tab of system variable → write path in variable name → write path of bin folder in variable value → ok → ok → ok

Path of the bin folder of the JDK and JRE is:

C:\Program Files\Java\jdk1.8.0_102\bin

C:\Program Files\Java\jre1.8.0_102\bin


So add ";C:\Program Files\Java\jre1.8.0_102\bin" after JDK path in the path string.

Remember: In PATH string there is a semicolon between JDK and JRE bin folder path.


My full path to the bin folder of the JDK and JRE is:

PATH:- "C:\Program Files\Java\jdk1.8.0_102\bin;C:\Program Files\Java\jre1.8.0_102\bin"


Set Java Path and Classpath in System Variable:-

1. From the desktop, right-click the Computer icon.

2. Choose Properties from the context menu.

3. Click the Advanced system settings link.

4. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.

5. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

6. Re-open Command prompt window, and run your java code.


I hope this post is very helpful to you don't forget to share this post with your social network.

Subscribe to the latest article updates via email:

1 Response to "Java Path and Classpath Setting in Windows 7"

Top Adverts Articles

Middle Advertisements Article 1

Middle Advertisements Article 2

Bottom Ad Article