How to configure environment variables in Java?

As a developer, installing the Java development environment on your own system and setting environment variables is a must-have skill. Today Xiaoqian will teach you how to configure environment variables.

Configuration steps

1. First of all, you must install the Java environment. This step is relatively simple, and the next step is enough. Please remember that we need to use it later in the installation path. Then we right-click on the computer icon on the desktop and select properties. In the page that opens, we click on the advanced system settings on the left, and then we can see the button for environment variables.
Insert picture description here

2. After clicking in, you can see that there are two variable settings, we select the new option under system variables to create a new variable
Insert picture description here

3. After that, we need to use the path where Java was just installed. In it, we enter the variable name "Java_Home", and the variable value is the path installed by ourselves. Here, Xiaoqian is installed on the D drive, as shown in the figure.
Insert picture description here

4. After clicking OK, we also need to modify the path variable, find the path in the system variables, and then select it and click the edit button on the right.
Insert picture description here

5. After that, you can see an item starting with Java in the opened window, select it and click Edit.
Insert picture description here

6. In the editing page that opens, enter the following paragraph of text to the top and save it. Note that there are no quotation marks on both sides, "%Java_Home%\bin;%Java_Home%\jre\bin;"
Insert picture description here

7. The last step is to create a new CLASSPATH. Click New on the system variable page you just opened. The variable name is "CLASSPATH" and the variable value is ".;%Java_Home%\bin;%Java_Home%\lib\dt. jar;%Java_Home%\lib\tools.jar", click OK to save, and note that there are no double quotation marks.
Insert picture description here
At this point, all configurations are complete, and you can verify it.

Guess you like

Origin blog.csdn.net/xiaoxijinger/article/details/114884392