Home >Java >javaTutorial >How to configure java environment variables?
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.
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:
Start installing JDK:
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" button
#2. Create a new JAVA_HOME variable
Click New... button
Input:
变量名:JAVA_HOME 变量值:电脑上JDK安装的绝对路径
Click OK after completing the input.
#The following files must be visible in the JDK path.
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.
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
5. Check to open cmd, enter java, and a series of command prompts will appear. , indicating that the configuration is successful:
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!