First install jdk, click to open the window shown below.
Click "Next" in the picture above to enter the picture below. The red box in the picture below indicates the installation path.
Click on the image above to proceed to the image below, and click "Finish".
Configure the java environment variables below, right-click the computer icon, as shown below:
After clicking on the properties above , the system window will pop up, click the "Advanced System Settings" button pointed by the red arrow on the far left to pop up the "System Properties" window, click "Environment Variables" pointed by the middle arrow in the system properties window, and the environment variables window will pop up.
Click the New button pointed by the red arrow in the figure below, the "New System Variable" window will pop up, set the variable name: JAVA_HOME, variable value: C:\Program Files (x86) \Java\jdk1.8.0_121
New variable name: CLASSPATH, variable value: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools .jar;
Edit the variable Path and append ":%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;" after the Path variable value.
Finally, open the command window and enter "java -version". If the version information is output, the java environment variable is configured successfully.
Many java training videos, all on the PHP Chinese website, welcome to learn online!
The above is the detailed content of How to configure environment variables in java. For more information, please follow other related articles on the PHP Chinese website!