Download the JDK that matches the system on the Oracle website as follows:
- 2
To install jdk1.7 as an example, double-click Run Jdk-7u80-windows-x64.exe and click Next:
(Note: Choose a directory with a file name without spaces when selecting the JDK installation directory)
- 3
The installation screen appears and waits for the installation to complete:
- 4
After the JDK installation is complete, the installation interface of the JRE appears, change the installation directory of the JRE, and click Next:
- 5
The JDK installation was successful, click Close.
- 6
According to the installation method of jdk1.7, install jdk1.8 and jdk1.8 respectively, the directory after the installation is complete
END
Configuring Environment variables
- 1
Right-click the computer, select Properties, select Advanced System settings, and create a new system environment variable:
Variable name (N): Java_home
Variable Value (V): JDK installation directory
(e.g. C:\Application\Develop\Java\jdk\jdk1.7\jdk1.7.0_80)
- 2
New system environment variable CLASSPATH:
Variable name (N): CLASSPATH
Variable Value (V):.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;
- 3
Edit environment variable Path:
Variable name (N): path
Variable Value (V):%java_home%\bin;%java_home%\jre\bin;
END
Test JDK installation Complete and switch JDK version
- 1
Win + R, enter cmd, enter the Java command at the command prompt, as shown below:
- 2
Enter the Javac command at the command prompt, which appears as follows:
- 3
To view JDK version information, at the command prompt, enter the java-version command:
- 4
To switch the JDK version, you only need to modify the corresponding Java_home value, such as switching to jdk1.8, just change the java_home value to C:\Application\Develop\Java\jdk\jdk1.8\jdk1.8.0_ 131. View the version of the JDK after switching:
Installing and configuring multiple versions of the JDK under Windows