You must establish two things:
The first is in the "User Variables for [your username]" section. Add the JAVA_HOME variable and set it where your jdk is installed. i.e. C: \ Program Files \ Java \ jdk1.7.0_51 \
The second is in the System Variables section. You must find the path variable and edit it. Then add ";% JAVA_HOME% \ bin" (minus quotation marks) to the end of the path variable.
After you have done this, save the variables and close this window by clicking the "ok" button. Close all instances of the command line (and any IDE you can develop, such as Eclipse or NetBeans), and reopen one command line. Then, if you want to check if your changes worked or did not change, try the following:
echo %JAVA_HOME%
This should be output where you set the java home variable.
echo %PATH%
At the end of what is output, you should see your java home \ bin complement to the path variable
java -version
If you can run this command from the command line, it means that your environment has been configured correctly, and java is now in your path.
Mike elofson
source share