0

On newly installed windows 10 64bit, I did install first, Oracle JDK 12, then installed Oracle JDK 8 update 211, and finally installed Oracle JDK 11.

So now in the C:\Program Files\Java\ there exits 4 folders

jdk1.8.0_211, jdk-11.0.3, jdk-12.0.1, jre1.8.0_211

In the Environment Varibales -> System Varibales I have the JAVA_HOME with value C:\Program Files\Java\jdk-11.0.3 and in the path I have added %JAVA_HOME%\bin

But yet after logout/login and restart still the command java -version on cmd and git bash outputs wrong version

$ java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

How should I fix the problem?

1 Answers1

4

Thanks to this answer the commands for %I in (java.exe) do @echo %~$PATH:I showed that there exists a wrong path to java.exe in the Path variable. As the contents of the Path was too long I was not seeing it. in my case (C:\Program Files (x86)\Common Files\Oracle\Java\javapath)

So the solution is:

  • Move that to the end of the list or delete it
  • rename all java*.exe files to e.g. java*_foo.exe in case of future use