I have two javas installed on my pc. jdk1.7.0_45 (x64)
and jdk1.6.0_45(x86)
. I want that default java on my machine would be jdk1.6.0_45(x86)
. I added JAVA_HOME
with value C:\Program Files (x86)\Java\jdk1.6.0_45
and added C:\Program Files (x86)\Java\jdk1.6.0_45\bin
to system path, but still when i type in command prompt "java -version" it says:
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
I have no idea why the things are like that, because my OS should see jdk1.7.0_45 (x64)
version. Why is that so?
I use windows 8
edit:
after setting java home to jdk1.7.0_45 (x64) folder and updating path accordingly javac works, but then I set java home and path to jdk1.6.0_45(x86) javac does not work.
You need to add the %JAVA_HOME%\bin
to the very beginning of your path. This is because Java is installed in your %SystemRoot%\system32
, too. If you add the %JAVA_HOME%\bin
to the beginning of your path the Java installed in your JAVA_HOME
will be used.