First, download JDK and JRE from the official website
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Click in and select the corresponding operating system to download and install
Next, the second step, environment variable configuration
1. Create a new "JAVA_HOME" system variable, the value is: D:\jdk (this is the installation directory just now, write it yourself)
2. Create a new CLASSPATH system variable, the variable value: .;%JAVA_HOME%\lib\dt.jar ;%JAVA_HOME%\lib\tools.jar; (pay attention to the dot and semicolon in front, which means that all files in the directory or subdirectory are applied, or write .;%JAVA_HOME%\lib; that’s it)
3. Create a new PATH variable, variable value: %JAVA_HOME%\bin;
Next, check whether the configuration is complete, press win+R to open the command prompt, enter java to get javac, and the following interface appears, the configuration is successful
Tip: If it appears that'JAVAC' is not an internal or external command, nor an executable program or batch file, just repeat the above operation