How to set java environment variables: 1. Open [Computer], [Properties], [Advanced System Settings], [Environment Variables] in sequence; 2. Create a new [JAVA_HOME] variable and edit the [Path] variable ;3. Finally, create a new [Classpath] variable and edit it.
Specific method:
First right-click [Computer] and enter [Properties] and then select [Advanced System Settings]
Click to enter [Environment Variables] in [Advanced] to enter the environment variable editing interface
Recommended video tutorial: java video tutorial
In the [System Variables] below, the JAVA_HOME variable does not exist, then we need to click [New]
Variable Name input: JAVA_HOME
The variable value refers to the actual installation path (for example: C:\Program Files\Java\jdk-9).
Finally click OK.
Path variable setting
Also in [System Variables] we can see that the path variable already exists, then we only You need to click [Edit] to enter the editing of the path variable
The variable name remains unchanged and the variable value is changed to [%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; 】, and finally click OK
Classpath variable setting: There is no need to set classpath after java1.5 version
Similarly, in the system There is also no Classpath variable present in the variables. Click to enter [New]
Type the variable name [Classpath]
Type the variable value [.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME %\lib\tools.jar; ]
Note: Do not miss the symbols in the variable value.
Finally click OK.
Recommended related articles and tutorials: java introductory tutorial
The above is the detailed content of How to set java environment variables. For more information, please follow other related articles on the PHP Chinese website!