Download the Java JDK and install it a directory without white spaces. For example,
c:\Java
.Ensure that the JDK folder is located inside the Java folder.
Add the JAVA_HOME environment variable:
Click Control Panel > System and click the Advanced system settings link.
Click Advanced, then click Environment Variables.
Add JAVA_HOME as a new system environment variable and specify the Java Development Kit installation path as the value, and then click OK. For example,
c:\Java\jdk1.7.0_51.
From the command line, validate the JAVA_HOME environment variable. Enter:
Echo %JAVA_HOME%
The path you specified as the JAVA_HOME value should be returned. For example:
c:\Java\jdk1.7.0_51
As the administrator, update your PATH environment variable:
In the System Variables field, select PATH and click Edit.
After the last entry in the PATH value, enter a semi-color and add the installation path to your JDK. For example:
...;c\Java\jdk1.7.0_51\bin.
Click OK.
From the command line, validate your PATH environment variable edit by entering:
java version
The return value should b the JDK version details. For example:
Java version "1.7.0."