How to set the environment variables for Java in Windows (the classpath)?
In Windows 7, right-click on Computer -> Properties -> Advanced system settings; then in the Advanced tab, click Environment Variables... -> System variables -> New....
Give the new system variable the name JAVA_HOME
and the value C:\Program Files\Java\jdk1.7.0_79
(depending on your JDK installation path it varies).
Then select the Path
system variable and click Edit.... Keep the variable name as Path
, and append C:\Program Files\Java\jdk1.7.0_79\bin;
or %JAVA_HOME%\bin;
(both mean the same) to the variable value.
Once you are done with above changes, try below steps. If you don't see similar results, restart the computer and try again. If it still doesn't work you may need to reinstall JDK.
Open a Windows command prompt (Windows key + R -> enter cmd
-> OK), and check the following:
java -version
You will see something like this:
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
Then check the following:
javac -version
You will see something like this:
javac 1.7.0_79