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:

  1. 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”.
  2. Open the “Control Panel” and click on “System and Security”.
  3. Click on “System” in the “System and Security” section.
  4. Click on “Advanced System Settings” in the “System” tab.
  5. Click on the “Environment Variables” button in the “System Properties” pop-up.
  6. In the “Environment Variables” pop-up window, you can see two sections: “User Variables” and “System Variables”.
  7. Find the “Path” variable in the “System Variables” section and click “Edit”.
  8. Click on the “New” button in the “Edit Environment Variables” popup window.
  9. 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”.
  10. After confirming the saving of the newly created system variable, click the “Create” button again.
  11. In the “New System Variable” dialog box, enter the variable name as “CLASSPATH” and the variable value as “%JAVA_HOME%\lib”.
  12. After confirming the saving of the newly created system variable, click on the “OK” button to close all pop-up windows.
  13. 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.

bannerAds