The system takes win 7 as an example:
1) Download Java JDK installation (in version 1.8.0_45 for example), the directory will appear jdk1.8.0_45 and Jre1.8.0_45 folder after successful installation;
2) Environment variables, advanced system settings, properties, computer
3) If there is no java_home variable in the system variable, then the value of the variable entered in the Java JDK installation directory is: C:\Program Files (x86) \java\jdk1.8.0_45 (note that there was no ";" );
4) If there is no path variable in the system variable, the value of the variable is entered in the Java JDK installation directory under the bin directory namely:C:\Program Files (x86) \java\jdk1.8.0_45\bin; (If you have a path variable, simply add the bin directory at the end of the variable value and note that the last ";")
5) If there is no classpath in the system variable, then the variable value is entered in the Java JDK installation directory of the Lib directory is:.; C:\Program Files (x86) \java\jdk1.8.0_45\lib (note value preceded by ".;") ;
6) Verify that the environment variable setting is successful, run CMD, enter java,javac,java-version separately, return to verify, if not "' * * * ' is not an internal or external command, is not a running program or batch file. , that is, the setting is successful.
[Java] environment variable settings