JAVA_HOME environment variable does not work

        After installing the new JDK8/JDK10 recently, I found that the previously configured JAVA_HOME environment variable did not work. Every time I entered java -version in CMD, it was the latest installed Java version, not the version configured by JAVA_HOME. It turns out that after the new version of JDK is installed, two new parameters will be added to the PATH variable by default. 

      C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;

  Open the corresponding folder and find the following:

  So there are several solutions:

  1. Delete these two variables

  2. Move the Java Path variable configured by yourself (ie %JAVA_HOME%\bin;) to the front of these two variables

  3. You can also directly delete the files under these two folders by brute force, which will also execute Java commands from the Java Path path configured by yourself.

 

  The function of the Path variable in simple science is to tell the system that when the system is asked to run a program without telling it the full path where the program is located, the system should search in which directories besides the current directory for this program.

 

Guess you like

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