0

I upgraded to java and set to following advance envirnment variables frrom windows UI(not by command prompt)

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_51
PATH = %JAVA_HOME\bin%

when i do java - version it reflects the right java version as "1.7.0_51"

but when i try to revert back to jav java 6 after reverting java_home (from windows UI )back to

JAVA_HOME = C:\Program Files\Java\jdk1.6.0_43
PATH = %JAVA_HOME\bin%

i opened new commad prompt but java - version still reflects the java version as "1.7.0_51"

should it not reflect java version as.6.0_43 ? Can't i go back to java 6 just by reverting java_home?

Kara
  • 6,115
  • 16
  • 50
  • 57
user3198603
  • 5,528
  • 13
  • 65
  • 125
  • http://stackoverflow.com/questions/20410555/java-default-version-doesnt-reflect-after-path-change?rq=1 tried this? – Zavior Jan 19 '14 at 09:39
  • 2
    It's not clear where you're running any of this... are you editing the environment variables in a command prompt - and then starting another command prompt? Note that JAVA_HOME is basically irrelevant in most cases. – Jon Skeet Jan 19 '14 at 09:39
  • @Jon Skeet updated my post to make it more clear – user3198603 Jan 19 '14 at 09:43
  • Right, if you did that in the Windows UI then it would only change the user-specified part of the path - so C:\WINDOWS\System32\ would still be earlier in your path. Type `PATH` in your command prompt to see the full path and check. – Jon Skeet Jan 19 '14 at 09:44
  • When i type PATH i see "C:\Program Files\Java\jdk1.6.0_43\bin". so why java -version still reflect java 7? – user3198603 Jan 19 '14 at 09:47
  • @user3198603: Is that *all* you see? I see half a page of stuff... – Jon Skeet Jan 19 '14 at 09:47
  • here is complete value "PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32 \WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft Application Virtualiza tion Client;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Progra m Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\; C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C – user3198603 Jan 19 '14 at 09:50
  • :\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C :\Program Files\TortoiseSVN\bin;C:\Program Files\SlikSvn\bin\;C:\Program Files\C ode Collaborator Client;C:\Program Files\Quest Software\JProbe 9.0.1\bin;C:\apac he-maven-3.0.3\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6 .0_43\bin;C:\Program Files\Quest Software\JProbe 9.0.1\bin" – user3198603 Jan 19 '14 at 09:51
  • Also i am using 64 bit java – user3198603 Jan 19 '14 at 09:54
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/45569/discussion-between-user3198603-and-jon-skeet) – user3198603 Jan 19 '14 at 10:03
  • @Jon Skeet is java version is reading from some registry file instead of java_home? – user3198603 Jan 19 '14 at 10:11
  • 3
    `java -version` finds the first `java.exe` on the system path and executes it. That `java.exe` has a version associated with it. If this `java.exe` is in `System32`, then it is actually a stub which will read the registry to find out which `java.exe` to delegate to, based on the current Java version setting in the registry. – Marko Topolnik Jan 19 '14 at 10:12
  • Solution: either place a Java `bin` directory on the *system-wide* PATH, as the first entry in it, or edit the registry to change the default java version. – Marko Topolnik Jan 19 '14 at 10:14
  • @ Marko Topolnik . Thanks . One more question. I can revert back to java 6 just by changing the path and classpath. Right? i dont have to change anywhere else . Right? Can we quick chat for 5 minutes. i am bit stuck after java 7 upgrade. I would be greatful if can give me 5 minuts? – user3198603 Jan 19 '14 at 10:34

1 Answers1

2

There is probably a java.exe in your C:\WINDOWS\System32\ folder leftover from the previous installation. Replace it with the one in C:\Program Files\Java\jre6\bin.

ashokramcse
  • 2,841
  • 2
  • 19
  • 41