Windows 10 install JDK configuration environment variables

Download JDK

Download link: https://www.oracle.com/java/technologies/javase-downloads.html

Insert picture description here

Enter the link to select the version you need to download

After the download is complete, the installation starts, the installation directory can be customized, and other items directly default to the next step, the default: C:\Program Files\Java\jdk1.8.0_261

Environment variable configuration

1. Open the environment variables window

Right click on This PC -> Properties -> Advanced system settings -> Environment Variables...

Insert picture description here

2. Create a new JAVA_HOME variable

Click the New... button

Insert picture description here

enter:

变量名:JAVA_HOME
变量值:电脑上JDK安装的绝对路径

Insert picture description here

3. New/modify CLASSPATH variable

If there is a CLASSPATH variable, select it and click Edit .

If not, click New... New.

Enter/add after the existing variable value:

变量名:CLASSPATH
变量值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;

Insert picture description here

4. Modify the Path variable

Note that the different paths of the Path variable are separated in win10

Insert picture description here

Create two new paths:

%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin

5. Check to open cmd, enter java -version, the following message appears, indicating that the configuration is successful:

Insert picture description here

Guess you like

Origin blog.csdn.net/Mr_Bobcp/article/details/108621926