1. First install the Java JDK, the installation process can not install the JRE.
2. Configuring the JDK environment variables
2-1. Create a new Java_home variable and add a value
Variable name: Java_home variable Value: C:\jdk1.8.0_131
2-2. Add a Path value
Variable name: Path variable Value: C:\jdk1.8.0_131\bin or%java_home%\bin
2-3. Create a new Class_path variable and add a value
Variable name: Class_path variable value:.; C:\jdk1.8.0_131\lib; C:\jdk1.8.0_131\lib\dt.jar; C:\jdk1.8.0_131\tools.jar or.; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\tools.jar
3. Code test environment variable If there is a problem
3-1. Create a new Test.java file that reads as follows:
public class test{
public static void Main (string[] args) {
System.out.print ("success\n");
}
}
3-2. Open a new CMD window
1) Input Javac Test.java//No output indicates successful compilation
2) Input Java Test//Output success indicates that there is no problem with the environment variables configured above
Configuring Java JDK Environment variables