I already had JDK 5 on my machine. I have updated JDK by installing Java Development Kit 7. Now, I have set the Path and JAVA_HOME variables as per latest Java. but still "java -version" showing me older version.
C:\>java -version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)
Please see the current states of my environment variables as below:
C:\>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.7.0_03\
C:\>echo %Path%
C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Barclays Capital\CommonApi\bin\
;C:\Program Files\Windows Imaging\;C:\WINNT\system32\WindowsPowerShell\v1.0;C:\Program Files\Citrix\ICAService\;C:\Program Files\Citrix\Syst
em32\;C:\Program Files\Perforce;C:\Program Files\Barclays Capital\P4CustomTools;C:\Program Files\Apache Software Foundation\apache-maven-3.0
.4\bin;C:\Program Files\Common Files\Adobe\AGL;C:\Apps\oracle\product\10.2.0.3\client\bin;C:\Apps\oracle\product\10.2.0\client\BIN;C:\APPS\o
racle\client\11.2.0.3\home1\bin;C:\WINNT\system32\;C:\WINNT\;C:\WINNT\system32\Wbem;C:\Program Files\Windows Imaging;C:\Program Files\Java\j
dk1.7.0_03\bin
C:\>javac -version
javac 1.7.0_03
I know how to change the environment variable and I have referred other post on stack overflow.
What should be reason behind incorrect path returned by java -version
command ?
Best Answer
When installing a public
JRE
(used by the Java plugin), a java.exe file is also created inC:\WINNT\system32
(IIRC). It's probably this java command that is executed, sinceC:\WINNT\system32
comes before theJDK/bin
directory in your PATH.Put the JDK/bin directory at the beginning of the
PATH
.