How to change from the installed version of jdk to the non-installed version under windows

background

The official website generally only provides exe files under windows, not zip files. Some are unwilling to use the installed version. What should I do if I want to use the non-installed version?

Solution

This article takes the installation of jdk-6u35-windows-x64.exe under windows 7 as an example

  1. Download jdk-6u35-windows-x64.exe

  2. Create a directory named jdk6, with any name and location.

  3. Click jdk-6u35-windows-x64.exe, select the path as jdk6, and continue.

  4. When choosing the installation path, choose Cancel. At this time, the files of the free installation version already exist in jdk6. The file directory is as follows:

How to change from the installed version of jdk to the non-installed version under windows

  1. The environment variables can be configured at this time.

Right-click "My Computer"-->"Advanced"-->"Environment Variables"

1) Create a new JAVA_HOME variable in the system variables, the variable value is: jdk6 (fill in according to your own installation path)

2) Create a new classpath variable, the variable value is: .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar

3) Add a variable value to the path variable (existing without creating a new one): %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin (note that the variable values ​​are separated by ";"

  1. Enter the dos window

Enter the command: java -version

Install ok if it is correct, otherwise please find out the reason by yourself.

to sum up

This method is also suitable for installing jdk 8, jdk9, to jdk12 under window10. This article only uses jdk under window as an example, don’t be limited to this environment.

Guess you like

Origin blog.51cto.com/15015181/2556404