1. Install the JDK, the installation process can customize the installation directory and other information, such as we choose the installation directory for D:\Program files\java\jdk1.6.0;
2. After the installation is complete, right-click on "My Computer" and click "Properties";
3. Select the "Advanced" tab and click on "Environment variables";
4. In "System Variables", set 3 properties, Java_home,path,classpath (case does not matter), if already exist then click "Edit", do not exist then click "New"
5.①java_home indicates the JDK installation path, which is the path D:\java\jdk1.5.0_08 (jdk1.5.0_08 can not write) that was selected at the time of installation, for example, my installation path is C:\Program Files\java so Java_ The value of home is C:\Program Files\java. This path includes folders such as LIB,BIN,JRE (this variable is best set, since it is required to run tomcat,eclipse, etc.)
②path allows the system to identify JAVA commands under any path, set to:%java_home%\bin;%java_home%\jre\bin
③classpath is the Java load class or lib path, only the class is in Classpath, the Java command is recognized, set to:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar (to Add. Indicates the current path)%java_home% is referring to the java_home specified earlier;
6. "Start"->; " Run, type "cmd";
7. Type the command "Java-version", and a screen appears stating that the environment variable is configured successfully