dukenukem6487
dukenukem6487

Reputation: 61

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!

Upvotes: 3

Views: 1079

Answers (4)

VHS
VHS

Reputation: 10194

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.

Upvotes: 2

Viacheslav Shalamov
Viacheslav Shalamov

Reputation: 4427

Probably your JAVA_HOME or just PATH environment variables were changed.

Go to command line and do the following to check it:

> echo %JAVA_HOME%  

For example, for me it gives back:

C:\Program Files\Java\jdk-9.0.4

Upvotes: 4

macka_macka
macka_macka

Reputation: 71

Your JAVA_HOME variable might still be set to JDK 7 directory, however the Java 10 installation may have inserted it's /bin directory to the PATH.

Check to ensure that java 10 isn't on the PATH before java 7, or hasn't overwritten it.

CMD etc. check the path for the binaries for commands like java-version.

Upvotes: 2

Elhoussine Zennati
Elhoussine Zennati

Reputation: 301

If you are using a java ide , you might find the location in JRE configurations. for example in eclipse :

windows > preferences > Installed JREs

.

Upvotes: 2

Related Questions