Wednesday, January 17, 2018

environment variables - Wrong java -version being reported


I am running Windows 7 Professional x64 and have the following Java versions installed:


x64



  • C:\Program Files\Java

    • jdk1.6.0_24

    • jdk1.7.0_04

    • jdk1.7.0_07

    • jre6

    • jre7



x86



  • C:\Program Files (x86)\Java

    • jre1.6.0_07

    • jre6

    • jre7



in my environment variables I have my PATH containing C:\Program Files\Java\jdk1.6.0_24\bin and JAVA_HOME set to C:\Program Files\Java\jdk1.6.0_24\bin


However running java -version reports


java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

How is this the case when there is no reference to this version of Java in my Environment variables.


Any help on this issue would be great as I am trying to run Apache ANT using Java 1.6.


Answer



You're probably have java.exe copied over to one of system paths (AFAIK that's Java installer default behavior).
To check what actually executes when you run 'java -version' run from command line:
for %I in (java.exe) do @echo %~$PATH:I and it will tell you where it is.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...