Windows10 configures Java environment variables (install jdk----configuration variables)

Install JDK1.8

JDK8 download link: JDK1.8
downloads the corresponding version according to your own system, I downloaded 64-bit

JDK1.8 download
After clicking download, select I accept, click Download

click to download
If you are not logged in to Oracle, you need to log in to download (if you do not have an Oracle account, you can register for one)

Login to download
After logging in, you can download it, wait for the progress bar to finish, open it in the folder, and double-click the **JDK1.8-** file to install it.

Double click to install
Follow the prompts to install (the next step). You should pay attention to the following step. If you want to install JDK to a certain directory, you can choose it yourself.

installation location
Proceed to the next step and select the installation directory again (this installation directory is the directory of JRE) until it appears. If there is no previous one is the default, this one can also be kept as the default, and click Next

JRE installation path
You'll know it's installed when the close button appears!

Installed
This is the folder after my installation (I modified the folder name)

This is the folder I have installed

At this time, we will not do the test, and we will test after the environment variable configuration is completed!

Environment variable configuration

First, we find the computer picture on the desktop, right-click, and select Properties. The system settings will open. Select Advanced System Settings below

Advanced System Settings
Pop-up system properties, select environment variables.

system properties
At this point, we click New in System Variables, and a new window pops up
. Fill in the variable name and variable location in the pop-up window, as shown below:

Variable name: JAVA_HOME Variable value: D:\Dev_Environment\java\jdk1.8
where the variable name is the name of the variable
variable value is the path of the newly installed JDK (change according to your installation location)

variable name
Create the CLASSPATH path in the same way

Variable name: CLASSPATH Variable value: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
Note: (Add . to indicate the current path)

classpath
Next, find the "PATH" path, click "Edit" to add our variable path

path

Add the following two paths in the path path (these two paths are best placed at the top of the path)
and click New to add

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

path
Click OK, OK, OK. At this point, the Java environment variables have been configured! Next we use DOS for testing!

test

Search for CMD, find the command prompt, and open it as an administrator.

insert image description here
After opening, there is a black box (using the English input method)
to enter **java -version**, **java**, javac commands to test, and press Enter after typing, when the following interface appears, it proves that the environment variable configuration is successful!

javajavac
If the java command is available, but the javac command is not, you need to carefully check the configuration of the environment variables. On the contrary, it is necessary to check carefully!
If Error: could not open `D:\Java\jre7\lib\amd64\jvm.cfg';JAVA_HOME is prompted , put the java path location in the path path to the front (open a new DOS window and test again).

Guess you like

Origin blog.csdn.net/qq_42320934/article/details/121068605