Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java path not getting reflected even after changing the PATH variable when working with multiple java versions

Tags:

java

When I am working with multiple versions of Java in my windows machine - 1.6 & 1.7, and when I try to switch from 1.7 to 1.6, and modified the PATH environment variable, it's still showing the 1.7 version only. How can I fix it?

like image 418
Jagadeesh Keerthi Avatar asked Sep 15 '25 08:09

Jagadeesh Keerthi


1 Answers

Java installations on Windows machines also copy a java.exe file into the directory C:\Windows\System32 (as well as a javaw.exe and a javaws.exe).

As this directory is usually also part of the PATH environment variable and - also usually - is mentioned before any program directory, you will see the output of the java.exe file that is from the system directory.

The path usually looks like:

PATH = [...];C:\Windows\System32;[...];C:\Program Files\Java\jdk7\bin;[...]

So even if you switch it to

PATH = [...];C:\Windows\System32;[...];C:\Program Files\Java\jdk6\bin;[...]

you will get a "Version 7" output on the console. If you instead change your path variable to

PATH = C:\Program Files\Java\jdk6\bin;[...];C:\Windows\System32;[...]

then you will get the "Version 6" output.

like image 55
Seelenvirtuose Avatar answered Sep 16 '25 23:09

Seelenvirtuose