1. Find the configuration location
Right click Computer > Properties > Advanced System Settings > Environment Variables
2. Configure environment variables in system variables
New JAVA_HOME
Variable name: JAVA_HOME
Note: The variable value is the file location where the java jdk is located.
For example: For example, the jdk installation location is C:\Program Files\Java\jdk1.6.0_43, then the variable value is filled in C:\Program Files\Java\jdk1.6.0_43
3. New CLASSPATH
Variable name: CLASSPATH
Variable value: " .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; "
Note: Do not drop the .; in the variable value
If you add it to the beginning of the path, just copy " %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; " and paste it at the beginning of the path .
If added to the end of the path, add " ; %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin " directly after the path
Enter the java command:
Enter javac:
Enter java -version:
If the above display is similar, the java environment variable configuration is successful.