Win10 installs multiple jdk, coexistence environment configuration, free switching is extremely convenient [detailed tutorial]

Cause:

        I started a new project today. It is a very ancient ssh project. I still use jdk1.7 and external tomcat. I am used to writing springboot. Where can I remember this configuration, so the project must give me an hour to run. I just need to bite the bullet, including idea importing web projects, and configuring multiple jdk;

Local environment:

        Windows10 + jdk1.8

demand:

        While not affecting the operation of other projects, it also needs to support the current project, so the idea is how to configure multiple jdk and easy to switch, can not really configure two sets; so I thought, the following configuration is really time-saving, and Convenience! If you don't believe me, let's look down!

 First of all, you must first understand: 

        When a version of jdk has been installed in the system, because jdk7 needs to be installed, at this time, after the installation is complete, use java -version to find information about the environment variables that are not configured. This is because C:\ProgramData\Oracle\ is generated by default when jdk8 is installed  Java\javapath file, and put java.exe javaw.exe javaws.exe under this file, and then put the path at the top of the path, so no matter how you configure the environment variables, using java -version is always installed 1.8 ;

        Therefore, the first thing to do is to clear the configuration generated by jdk1.8 by default. For example, if you install a high version of jdk first, then you want to install a low version of jdk;

first step:

1. Delete the three files under C:\Windows\System32

When jdk1.7 is installed for the first time, the three executable files of java.exe, javaw.exe, and javaws.exe are automatically copied to the C:\Windows\System32 directory, because this directory has a high priority in the Windows environment variables Priority of environment variables set in JAVA_HOME. So delete the three executable files java.exe, javaw.exe and javaws.exe in the C:\Windows\System32 directory .

2. Delete the Path C:\ProgramData\Oracle\Java\javapath generated by installing jdk8 in the system environment variables

When installing jdk8, C:\ProgramData\Oracle\Java\javapath; will be added to the front of the system variable Path during the installation process. This is brought out when installing jdk8 and is at the front of Path, so It is useless to modify the registry or the Java console. When the executed command searches for commands in the system variables, the first one found is C:\ProgramData\Oracle\Java\javapath;, which is always jdk8. Also delete.

3. Add two new environment variables : configure as follows: as shown below

JAVA_HOME     %JAVA7_HOME%
JAVA7_HOME    C:\Program Files\Java\jdk1.7.0_67
JAVA8_HOME    C:\Program Files\Java\jdk1.8.0_162

Note: If you want to change the current jdk version, just modify the value of JAVA_HOME directly, currently it is jdk1.7 that is read

4. Configure CLASSPATH 

//CLASSPATH
%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar

5. Configure Path, [Note: Add the path at the top! ! !

//Path
%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;

Note: After modifying the environment variables, be sure to remember to confirm and then confirm to take effect, and then close and reopen cmd! Otherwise it is easy to mislead oneself;

6, jdk1.7, jdk1.8win and other versions 

You need to add the group to pick up, group number: 708072830, you have all the group files you want, you can also use the water group in your spare time, exchange technology, etc.

There is no particular order in learning, no distinction in knowledge; no matter how big or small, you should ask for advice with an humility; if three people walk, there must be my teacher! ! !


  reference:

     1. Win10 install jdk1.7 jdk1.8 coexistence environment configuration  

     2. Install two jdk under windows 


❤If the article is helpful to you, please click like at the top right corner of the article or at the end of the article! (づ ̄ 3 ̄)づ 

❤If you like the articles shared by the white rabbit, please pay attention to the white rabbit! (๑′ᴗ‵๑)づ╭❤~

❤If you have any questions about the article, please leave a message below or join the group to discuss [group number: 708072830]

❤In view of the limited personal experience, all opinions and technical research points, if you have any objections, please reply directly to the discussion (do not make offensive remarks)

Guess you like

Origin blog.csdn.net/weixin_43970743/article/details/109480754