Teach you how to modify the version of the JDK

   Scenario introduction:

1: The computer has been using the JDK1.7 version, and I have been developing it honestly. It is very pleasant. Suddenly, one day, the company has a project that requires the minimum version of JDK1.8. It's too bad, I have to abandon my 1.7 environment to 1.8. ~~~

2: The computer has been using the JDK1.8 version. Suddenly, one day, I saw an open source project, but it is relatively old. Many jar packages in it are of low version and are not compatible with their own version. There is no way, in order to see The essence of other people's projects, you need to run the project, and then further study it step by step, oh no, just change the version~~

   In fact, the above two situations are very common problems in our development, that is, there is a conflict between our own development environment and some unexpected situations, and we have to make changes, and we all know that in many cases, the development process is not difficult. , but the configuration environment is enough to toss, so learning to change the environment configuration is also a skill that a developer needs. (Of course, the JDK version mentioned above is just an example, it is not limited to the transition between 1.7 and 1.8, what’s more, now that JDK10 is out, there is only one feeling, the speed of updating once every six months is quite fast~)

1: How to switch the JDK version

Function: According to the development environment of different projects and our own habits, we can switch the environment reasonably, which is convenient for us to carry out better project development.

Failed experience:

Take it for granted type: JDK version switching is very simple. Isn't it just a matter of modifying the JAVA_HOME in the environment variable to the version we need? It's not difficult, it's a piece of cake. . . .

Before modification (JDK1.8) environment variable: JAVA_HOME=D:\Download\jdk18\jdkdown

After modification (JDK1.7) environment variable: JAVA_HOME=D:\Download\jdk17\jdkdown

If, after this modification, then you do it from cmd: java -version

Result: Unfortunately, why is it still the previous version? Am I not modifying it? Later, I went back to check the environment variables. Indeed, I changed it. Why didn't it work? What happened? What happened, I was so melancholy and fell into deep thought. . . .crycrycry

Analysis: In fact, this modification is not wrong, but if it is just so simple to modify the path, then it is too naive to think. After we have configured and installed jdk, for the system, it is added by default. A lot of things, so of course it's not just that.

Steps to success:

1: Download the JDK version you need to modify. Needless to say, go directly to the official website to find it . http://www.oracle.com/technetwork/java/javase/downloads/index.html

2: After downloading the version, the corresponding steps are the same as the previous installation, but here you can distinguish the paths of the two versions.

3: Change the JAVA_HOME in the environment variable to the path of the JDK version you want to modify (that is, the path you stored after installation in the above steps)


Reminder: Why modify JAVA_HOME is not mentioned here. For Java developers, there is no need to say more, unless you are new to Java configuration~!

4: Modify the relevant content of the JDK that already exists in the system.

Enter the C drive -- "find the Windows folder -- "enter the System32 folder -- "delete the following three files


5: Find the bin folder in the JDK version directory to be replaced corresponding to the three cultures in step (4)

6: Copy the three files in step (5) to the directory in step (4)

To sum up, (4) (5) (6), it is to replace the three files of the previous JDK version with the content of the JDK version we need now.

7: Replace the three files in the C:\ProgramData\Oracle\Java\javapath directory , which are the three files mentioned above

(Because this is a hidden directory, we need to manually display it, not the file directory that can be directly manipulated

Steps: Organize - Folder and Search Options - View - Select "Show hidden files, folders and drives") 


8; Modify the registry: win + R, enter regedit to enter the registry editor, and modify the CurrentVersion of Java Development Kit and Java Runtime Environment (double-click to pop up the modification box) 

Steps: HKEY_LOCAL_MACHINE--->SOFTWARS--->JavaSoft

First, find the Java Development Kit directory: modify the currentVersion, if you want to modify the jdk to 1.7, then fill in 1.7, if it is changed to 1.8, then fill in 1.8


Second, find the Java Runtime Environment directory: same as above, the way of modification is still the same.


9: After all the operations are over, enter cmd to display the version of java to see.


The landlord, in order to test the actual effect, the previous jdk1.8 has been changed to 1.7. . . So, the test is effective~

Two: IDEA editor import MyEclipse project

step 1)

(2)

(3)

(4)

(5) Then continue to next

(6)

(7)

(8)

(9)

(10)

(11)

(12)

(13)


(14) Configure the content about Tomcat

(15)

(16)

(17)

(18)

(19)

Tips: If you need to modify the port of Tomcat, then modify the following content accordingly (this is not a necessary step)


(20) Then click apply and OK, that's it~

(21) Start the project, and you can import the MyEclipse project into Idea. Isn't this very convenient?


Three: The method of Idea editor to play War package

You can refer to this article of mine (absolute boutique): https://blog.csdn.net/cs_hnu_scw/article/details/79125582

Regarding some common methods of IDEA, I will continue to update them. In short, I still like this editor, and more and more enterprises are using this editor, so it is also good to know more about it. Very good choice. Welcome everyone's attention~~~~~Communicate with each other~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325581399&siteId=291194637