javawindowsversions

Where does Windows keep JDK location reference?


I previously had Java 7 installed on my Windows PC. System environment variable also had location to it. I installed Java 10 without uninstalling 7 or changing the environment variable. Now when I go to CMD or Cygwin and enter Java -version it says Java 10.

I would think since I didn't change the environment variable that it would still be 7. How is Windows deciding what JDK to use?

Thanks!


Solution

  • How is Windows deciding what JDK to use?

    Windows is NOT making decisions on its own. If you get version 10 information when you run java -version, it is because Windows is finding the folder containing java.exe corresponding to the version 10 first in the paths pointed to by the PATH environment variable. If you have installed Java using an installer, the installer would update the PATH variable for you. Check your PATH variable and you will see the Java 10 folder appearing there first and then Java 7 folder.