[Java development environment configuration] JDK installation configuration

Description: JDK refers to Java development tools, JRE refers to Java runtime environment, JDK contains JRE, and JRE contains JVM (Java Virtual Machine)

If you want to run Java programs, you only need to install JRE; if you want to develop Java programs, you need to install JDK. Generally, JDK can be installed directly.

1. Install JDK

The version used here is "jdk-8u172-windows-x64".

The specific JDK version can be downloaded from the oracle official website

JDK official website link

Insert picture description here

Insert picture description here

1.1 Installation procedure

1. Start the installer

Insert picture description here

2. Select the default directory

Insert picture description here

3. Select jre (Java runtime environment) default directory

Insert picture description here

4. Normal installation

Insert picture description here

5. Successful installation
Insert picture description here

1.2 Configure environment variables

After installation, you must configure environment variables to tell the operating system what the default jdk and jre of Java are. Need to configure 3 environment variables.

  1. Right-click "My Computer", open "Properties", and click "Advanced System Settings"
    Insert picture description here

2. Click "Environment Variables" to create a new variable "JAVA_HOME".

Insert picture description here

3. Go back to the "Environment Variables" window and click New (If you have installed another version of JDK before, there should already be a CLASSPATH variable, then double-click it). Then enter ".;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar", as shown in the figure. note! Be sure to add ".;" in front, otherwise an error will occur. Final confirmation.

Insert picture description here
Insert picture description here

  1. Back to the "Environment Variables" window, double-click the "path" variable to edit it.

Insert picture description here

5. "New", write two lines of new content "%JAVA_HOME%\bin" and "%JAVA_HOME%\jre\bin", as shown in the figure. Final confirmation.

Insert picture description here
Insert picture description here

  1. Then confirm all the way in the "Environment Variables" window and the "System Properties" window. Then open a command line window and enter the commands java and javac. If many lines of information appear, it means that the jdk installation is successful. If it prompts "not a legal command", it means an error.

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/hkdhkdhkd/article/details/109843039