Home  >  Article  >  Java  >  How to set java environment variables

How to set java environment variables

王林
王林Original
2020-02-02 20:34:0711194browse

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.

How to set java environment variables

Specific method:

First right-click [Computer] and enter [Properties] and then select [Advanced System Settings]

How to set java environment variables

Click to enter [Environment Variables] in [Advanced] to enter the environment variable editing interface

How to set java environment variables

Recommended video tutorial: java video tutorial

In the [System Variables] below, the JAVA_HOME variable does not exist, then we need to click [New]

How to set java environment variables

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.

How to set java environment variables

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

How to set java environment variables

The variable name remains unchanged and the variable value is changed to [%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; 】, and finally click OK

How to set java environment variables

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]

How to set java environment variables

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.

How to set java environment variables

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn