SEgeek
SEgeek

Reputation: 129

Java -version shows old version of java

I have JDK 1.7_51 and JRE 1.7.79 update. My JAVA_HOME is set to C:\Program Files\Java\jdk1.7.0_51 and JRE_HOME is set to C:\Program Files\Java\jre7(update 79) and PATH points to JDK 1.7_51/bin.

Why does the java -version doesn't point to the java 7 79 update? it points java 7 update 51. It should ideally point to the JRE update 79.

Upvotes: 5

Views: 7830

Answers (6)

Bose Ravula
Bose Ravula

Reputation: 21

Uninstall the old version of java and try to reinstall new version of java.. i think that will help you

Upvotes: 2

rahul raj
rahul raj

Reputation: 105

delete java.exe,javaaws.exe,javaw.exe from C:\Windows\system32 folder. and retry jave -version. It will show the newly updated version in the environment variables

Upvotes: 0

Rajas Gujarathi
Rajas Gujarathi

Reputation: 774

For Windows 10: 1) Open Command prompt

2) Type "where java" - Check all paths that are mentioned in the output

3) Go to environment variables -> PATH variable -> Edit -> Ensure that the the version you want to point to is in the list above all other paths.

4) Close the existing terminal, and open a new command prompt.

5) Type "where java" - Check all paths that are mentioned in the output, now your mentioned version path has to be the first in the output.

enter image description here

Upvotes: 2

Antflga
Antflga

Reputation: 624

Try changing your %JAVA_HOME% to the new installation directory and make all attempts to uninstall all previous java installations.

If you're unsure of how to do this, search for "Edit system environment variables" and that's where you'll find environment variables.

Upvotes: 0

Cristian J. Brito
Cristian J. Brito

Reputation: 199

You have to put the correct java Path in first place in you PATH variable environment, java es trying to execute the java from c:\windows\system32 first.

Upvotes: 0

Nir Alfasi
Nir Alfasi

Reputation: 53525

When you type in command prompt java it searches the PATH env variable and the first result it hits - returns. Since you pointed the PATH to JDK 1.7_51 - that's what you're getting.

JAVA_HOME environment variable is defined as an agreed protocol for applications that uses Java. It does not apply when you type in command prompt java -version (or java + any other switch).

Upvotes: 2

Related Questions