java_home not being set properly

installation, java, java-home

Solution

Java 6 is picked because it comes first in you PATH environment variable. It has nothing to do with JAVA_HOME variable, until and unless you specify you PATH variable using JAVA_HOME variable

Setting a new USER variables PATH as JAVA_HOME\bin, will solve your problem

Problem

I have 2 Java installed on my machine. 1.5 and 1.6. For the project, I need 1.5. I have set all of my path variables to appropriate i.e. ``` echo %JAVA_HOME% <PATH_TO_1.5_JDK> ``` which is what i want .. but when i do ``` java -version java version "1.6.0_33" Java(TM) SE Runtime Environment (build 1.6.0_33-b05) Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03, mixed mode) ``` why java v 6 is being picked for `java -version` command ? UPDATED I have already checked the `%PATH%` variable and the only java version that appears in path is 1.5. I am referring to `SYSTEM VARIABLES` variable here and I am using Win7

Original source