JAVA_HOME and java -version

user1345883 picture user1345883 · May 21, 2012 · Viewed 25.3k times · Source

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?

Answer

TheBakker picture TheBakker · Feb 10, 2017

For me the issue was in my PATH variable, C:\ProgramData\Oracle\Java\javapath; was added by java windows install before my %JAVA_HOME%\bin;. So I'd echo %JAVA_HOME% pointing to a JDK7 and java -version showing jdk8.

I'd to put %JAVA_HOME%\bin; before C:\ProgramData\Oracle\Java\javapath; so that java -version displays jdk7.