Article Directory
-
-
- ==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
- 1.1 Installation procedure
- 1.2 Configure environment variables
-
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
1.1 Installation procedure
1. Start the installer
2. Select the default directory
3. Select jre (Java runtime environment) default directory
4. Normal installation
5. Successful installation
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.
- Right-click "My Computer", open "Properties", and click "Advanced System Settings"
2. Click "Environment Variables" to create a new variable "JAVA_HOME".
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.
- Back to the "Environment Variables" window, double-click the "path" variable to edit it.
5. "New", write two lines of new content "%JAVA_HOME%\bin" and "%JAVA_HOME%\jre\bin", as shown in the figure. Final confirmation.
- 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.