Download, installation and environment configuration of JDK

Time:2022-1-13

JDK Download

Recommended Oracle official website:Java Software | Oracle
官方网站
The latest version of JDK or jdk8 is recommended here
jdk16

jdk8

JDK installation

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

JDK environment construction

Install configuration jdk8
Right click my computer, click properties to find advanced system configuration, and then click environment variables
在这里插入图片描述

JAVA_ HOME=C:\Program Files\java\jdk1. 8.0_ 301 // here is the path of the installed JDK
CLASSPATH = .;%JAVA_HOME%\lib;%JAVA_HOME%\dt.jar;%JAVA_HOME%\tools.jar
Path=%JAVA_ Home% \ bin // click Edit in it

Install configuration jdk16
This is consistent with jdk8, but the version 16 JDK is relatively short in the classpath

CLASSPATH = .;%JAVA_HOME%\lib

Check whether the configuration is successful
Open the console and enter the following commands to check
java
在这里插入图片描述
javac
在这里插入图片描述
jshell
在这里插入图片描述
java -version
在这里插入图片描述

Configuration note

After configuring the environment variables, you must confirm them all and close them step by step
After changing the JDK version, if you find that the Java version is still the previous version:
1. Set the Java environment% Java in the environment variable path_ Move home% / bin to the top (if unsuccessful, you can delete the Oracle environment)
2. Delete these three files in the directory C: \ windows \ system32 exe javaw. exe javaws. Exe (when installing JDK, the three executable files java.exe, javaw.exe and javaws.exe are automatically copied to the C: \ windows \ system32 directory, because the priority of this directory in the windows environment variable is higher than the priority of the environment variable set by java_home. If you execute the command under the installation path, you can see the current version)