1, first, according to their own needs to download 1.6 or 1.7 of the JDK, install JDK. (Remember the installation directory at the time of installation, it will be used later)
2. Right-click computer → properties → advanced system settings → advanced → environment variables, create a new variable named "Java_home" in the System variables section, the variable value is the directory where the JDK was previously installed, for example, "D:\Java\jdk1.6.0_10".
3. Create a new variable named "Classpath" in the System Variables section, and the variable value is ".; %java_home%\lib;%java_home%\lib\tools.jar ". (You can directly copy the contents between double quotes)
4, find the variable named "Path" in the System Variables section, click Edit, add ";%java_home%\bin;%java_home%\jre\bin" to the value of the variable. (You can directly copy the contents of the double quotes)
5, after the configuration of the above 3 variables, the configuration of the Java environment variable is complete, this time also need to verify that the configuration is successful.
Select Start → run ... → input cmd→ in the popup Run Command box input Javac, see the following screen indicates the configuration is successful.
Java environment variable configuration method under Win7