First, pre-preparation:
Right-click on the desktop My Computer, click Properties in the dialog box, then in the upper right corner of the window click Advanced System settings at the bottom left corner of the window click Environment variables to set, 1, Figure 2, Figure 3.
Fig. 1 Fig. 2
Figure 3
Second, set environment variables
First make clear that we need to configure three environment variables, namely Java_home,classpath,path
1. Variable name input: java_home, variable Value input: D:\Java\jdk1.8.0_05 click OK.
Special Note : The value entered by the variable value is the installation directory of your JDK, such as my JDK is installed in the Java folder of the D drive in the jdk1.8.0_05, my variable value is D:\Java\jdk1.8.0_05
2. Click the New button, enter the variable name: Classpath variable Value input:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar, click OK.
Special Note : When configuring CLASSPATH, the variable value is appended with the percent sign, and do not forget to add a semicolon at the back!
3. Note: (1). If you already have the path variable you can find the path, double-click the path, and then add the following value at the bottom of the variable value (at the end of the original value if not; then add it yourself; then add the following value).
(2). If you do not have a path variable, click the New button and enter it by the value below. Variable name input: Path variable Value input:%java_home%\bin;%java_home%\jre\bin click OK.
Third, test the Java development environment is successfully built
Enter java-version in CMD to see if there is any configuration information, and if so, the configuration is successful!
Annotation: The delimiter in an environment variable is a semicolon ";".
Building a Java development environment