How to set up the environment variables for JDK configuration?
To set up the environment variables for Java Development Kit (JDK) on a Windows system, you can follow these steps:
- Download and install the JDK, and make sure to set the installation path. For example, install the JDK in the directory “C:\Program Files\Java\jdk1.8.0_271”.
- Open the “Control Panel” and click on “System and Security”.
- Click on “System” in the “System and Security” section.
- Click on “Advanced System Settings” in the “System” tab.
- Click on the “Environment Variables” button in the “System Properties” pop-up.
- In the “Environment Variables” pop-up window, you can see two sections: “User Variables” and “System Variables”.
- Find the “Path” variable in the “System Variables” section and click “Edit”.
- Click on the “New” button in the “Edit Environment Variables” popup window.
- In the “New System Variable” popup window, enter the variable name “JAVA_HOME” and input the variable value as the installation path of the JDK. For example, input “C:\Program Files\Java\jdk1.8.0_271”.
- After confirming the saving of the newly created system variable, click the “Create” button again.
- In the “New System Variable” dialog box, enter the variable name as “CLASSPATH” and the variable value as “%JAVA_HOME%\lib”.
- After confirming the saving of the newly created system variable, click on the “OK” button to close all pop-up windows.
- Open the command prompt window and type the command “java -version.” If the Java version information is displayed correctly, it means the environment variable configuration is successful.
The steps above outline how to configure the JDK environment variable in a Windows system. Other operating systems follow a similar process, but the specific paths and interfaces may differ.