Search code examples
javaversionenvironment-variablesjava-home

JAVA_HOME and java -version


I'm using a Windows .bat script and I set JAVA_HOME as C:/Program Files/Java/jdk1.6.0_32 when I do a java -version, it still shows the 1.3

How can I fix this? What am I doing wrong?


Solution

  • Try %JAVA_HOME%\bin\java -version

    If you modify JAVA_HOME, it's usually better to invoke java with an absolute path (using JAVA_HOME) because the new binary is probably not in the path (and then Windows will load the wrong binary).