Incorrect java -version on command prompt

Umesh Patil

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 ?

user62916

When installing a public JRE (used by the Java plugin), a java.exe file is also created in C:\WINNT\system32 (IIRC). It's probably this java command that is executed, since C:\WINNT\system32 comes before the JDK/bin directory in your PATH.

Put the JDK/bin directory at the beginning of the PATH.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to compare Java version in Command Prompt?

From Java

Don't see java version 14 in command prompt

From Dev

Language version in Developer Command Prompt for VS 2017

From Dev

Java Compiling Error in Command prompt: class file has wrong version 52.0, should be 50.0

From Dev

Different Java version running in command prompt vs. Windows control panel

From Dev

Windows command prompt won't show results of commands like "java -version"

From Dev

Java - intellij vs command prompt

From Dev

Command Prompt: java file not found

From Dev

how to prompt "open file window" from command prompt in java?

From Dev

Tomcat7 Starts with Incorrect Java Version

From Dev

Bash: adding history -a to PROMPT_COMMAND makes incorrect calculation of last command's wall time

From Dev

Java Command-Line App with own prompt

From Dev

JDBC Java File Running Through Command Prompt

From Dev

Passing command prompt functions from java

From Dev

How to get command prompt output in java?

From Dev

How do you write to a command prompt in Java?

From Dev

JDBC Java File Running Through Command Prompt

From Dev

Java: compile and run hanging at command prompt

From Dev

Compiling and running a java program in command prompt

From Dev

How to run a java application (eclipse) on command prompt?

From Dev

Starting Background java using command prompt

From Dev

Trying to run a Java program from the command prompt

From Dev

Making manifest file in java by command prompt

From Dev

Errors When Running Java from Command Prompt

From Dev

Write to and read from the Windows Command Prompt by Java

From Dev

How to install java through windows command prompt?

From Dev

Check Curent Version of Scala inside Dos Command Prompt

From Dev

How to check the BIOS version or name in Linux through a command prompt?

From Dev

Apache and Command Prompt running two different version of PHP on windows

Related Related

  1. 1

    How to compare Java version in Command Prompt?

  2. 2

    Don't see java version 14 in command prompt

  3. 3

    Language version in Developer Command Prompt for VS 2017

  4. 4

    Java Compiling Error in Command prompt: class file has wrong version 52.0, should be 50.0

  5. 5

    Different Java version running in command prompt vs. Windows control panel

  6. 6

    Windows command prompt won't show results of commands like "java -version"

  7. 7

    Java - intellij vs command prompt

  8. 8

    Command Prompt: java file not found

  9. 9

    how to prompt "open file window" from command prompt in java?

  10. 10

    Tomcat7 Starts with Incorrect Java Version

  11. 11

    Bash: adding history -a to PROMPT_COMMAND makes incorrect calculation of last command's wall time

  12. 12

    Java Command-Line App with own prompt

  13. 13

    JDBC Java File Running Through Command Prompt

  14. 14

    Passing command prompt functions from java

  15. 15

    How to get command prompt output in java?

  16. 16

    How do you write to a command prompt in Java?

  17. 17

    JDBC Java File Running Through Command Prompt

  18. 18

    Java: compile and run hanging at command prompt

  19. 19

    Compiling and running a java program in command prompt

  20. 20

    How to run a java application (eclipse) on command prompt?

  21. 21

    Starting Background java using command prompt

  22. 22

    Trying to run a Java program from the command prompt

  23. 23

    Making manifest file in java by command prompt

  24. 24

    Errors When Running Java from Command Prompt

  25. 25

    Write to and read from the Windows Command Prompt by Java

  26. 26

    How to install java through windows command prompt?

  27. 27

    Check Curent Version of Scala inside Dos Command Prompt

  28. 28

    How to check the BIOS version or name in Linux through a command prompt?

  29. 29

    Apache and Command Prompt running two different version of PHP on windows

HotTag

Archive