Home  >  Article  >  Java  >  How to configure java environment variables?

How to configure java environment variables?

青灯夜游
青灯夜游Original
2019-12-31 11:58:232619browse

After Java is installed, Java environment variables must be configured correctly before they can be used correctly. But many people don't know how to configure it, so let's take a look at how to configure Java environment variables.

How to configure java environment variables?

JAVA environment variable configuration

1. Install JDK

Download address: https://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html

Click the download button:

How to configure java environment variables?

How to configure java environment variables?

Start installing JDK:

How to configure java environment variables?

can be set to the path you want to install.

Environment variable configuration

1. Open the environment variable window

Right-click the computer-> Properties->Advanced system settings->Environment variables , in the system variables, click the "New" buttonHow to configure java environment variables?

How to configure java environment variables?

#2. Create a new JAVA_HOME variable

Click New... button

How to configure java environment variables?

Input:

变量名:JAVA_HOME
变量值:电脑上JDK安装的绝对路径

Click OK after completing the input.

How to configure java environment variables?

#The following files must be visible in the JDK path.

How to configure java environment variables?

3. Create/modify CLASSPATH variable

If the CLASSPATH variable exists, select it and click Edit.

If not, click New... to create a new one.

Enter/add after the existing variable value:

变量名:CLASSPATH
变量值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;

Click OK to save.

How to configure java environment variables?

4. Modify the Path variable

Due to the differences in win10, when the Path variable is selected, the system will easily separate all different paths. , will not be connected together like win7 or win8.

Click New,

Create two new paths:

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

How to configure java environment variables?

5. Check to open cmd, enter java, and a series of command prompts will appear. , indicating that the configuration is successful:

1How to configure java environment variables?

Configuration purpose: Can execute javac and other programs in any directory without switching to the installation directory. Moreover, many later development tools will also identify JDK by reading environment variables.

Recommended learning: Java Video Tutorial

The above is the detailed content of How to configure 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