1. Download
Download JDK from the official website: https://www.oracle.com/cn/java/technologies/downloads/#jdk19-windows
At the end of the article, a link to the network disk of the JDK8 and JDK17 installation files based on Windows X64 is provided, please move to the end of the article .
1.1 Attention
- For different operating systems (windows, macOS, Linux, etc.), you need to download the corresponding version of JDK .
- If the computer is Windows 32-bit, it is recommended to reinstall the system to a 64-bit operating system .
- Java has not provided a 32-bit version of the installation package since version 9 .
1.2 The development history of JDK
1.3 Three important milestone versions
Java5.0: This is the first major version update of Java.
Java8.0: This is the version currently used by most companies. Because this version is the most stable.
Java17.0: This is the latest JDK version.
2. Install
2.1 Installation process
Double-click the installation file to enter the JDK installation window, click Next,
click Next again
, and click Close to complete the installation
The default installation path is under C:\Program Files\Java, and the installation path can also be customized.
suggestion:
-
The installation path should not contain Chinese characters, spaces or other special symbols .
-
In the future, all software suggestions related to development will be installed in the same folder for easy management.
2.2 JDK installation directory introduction
directory name | illustrate |
---|---|
bin | Various tool commands of the JDK are stored in this path. javac and java are placed in this directory. |
conf | The relevant configuration files of the JDK are stored in this path . |
include | Some platform-specific header files are stored in this path . |
jmods | Various modules of JDK are stored under this path. |
legal | The authorization documents of each module of the JDK are stored in this path. |
lib | Some supplementary JAR packages of JDK tools are stored in this path . |
3. Configure environment variables
3.1 Why configure environment variables
To develop Java programs, you need to use the development tools provided by JDK (such as javac.exe, java.exe and other commands), and these tools are in the bin directory of the JDK installation directory. If you do not configure environment variables, then these commands can only be used in bin directory, and we want to be able to use it in any directory, so we need to configure environment variables.
Note: Now the latest JDK downloaded from the official website will automatically configure the paths of javac and java commands to the Path environment variable during installation, so javac and java can be used directly .
3.2 Configuration method
The old version of JDK downloaded before is not automatically configured, and the automatically configured one only contains 4 tools, so we need to delete the configured ones and reconfigure the Path environment variable again.
①JAVA_HOME : Tell the operating system where the JDK is installed (in the future, other technologies will use this to find the JDK), and the attribute value is the installation directory of the JDK .
As shown in the figure below, the installation directory of JDK8 is still: C:\1Applications\Java\jdk1.8.0_261
Therefore, the attribute value of JAVA_HOME is C:\1Applications\Java\jdk1.8.0_261
②Path : Tell the operating system where the javac (compilation) and java (execution) commands provided by the JDK are installed. The attribute value is: %JAVA_HOME%\bin
3.3 Win10 bugs
When the computer is restarted, the environment variable becomes invalid. Indicates that the operating system does not support custom environment variables. (rarely this problem occurs)
step:
-
Still need to configure JAVA_HOME for future related software to use
-
We can configure the full path of java and javac to PATH.
3.4 Installation Verification
Enter the command in cmd: java -version
to view the corresponding installation version information.
3.5 Introduction to JDK and JRE
JVM (Java Virtual Machine), Java virtual machine
JRE (Java Runtime Environment), the Java runtime environment, includes the core class library of JVM and Java (Java API)
JDK (Java Development Kit) is called the Java Development Kit, which includes JRE and development tools
Summary: We only need to install JDK, which contains the java operating environment and virtual machine.
4. Configure JDK in IDEA
4.1 First check the jdk version installed on your computer
Enter the java -version command in CMD
4.2 Configure the JDK of the project
First configure the java editor version in IDEA
Then click the project structure icon in the upper right corner of IDEA
Modify the jdk version of the project
Modify the jdk version of the module
The program can be successfully run, and the JDK configuration is successful.
If the IDEA version is too low, it is impossible to successfully configure a higher version of JDK.
Either replace the new version of the IDEA editor, or reduce the version of the JDK.
5. Network disk link
Network disk link: https://pan.baidu.com/s/1I5p4MNSza6j39dRgiDagvg?pwd=igzn
Extraction code: igzn
Thank you for watching, one-click three links, looking forward to your likes + attention + favorites~ I wish you don’t get lost in learning ! ! !