13

I wanted to get Java running at 1.6xxx - I changed the JAVA_HOME variable and pointed it to the directory C:\Program Files\Java\jdk1.6.0._16.

I restart the PC - and I think I can check which version of Java my machine is pointing at - but it still points to the older version of Java e.g v1.5.0_16

Can you help me rejog my memory on correct setup for Java JDK?

java home

2
  • 1
    check your PATH variable and see which version of java is present on that.
    – Sagar V
    Sep 29, 2010 at 11:03
  • I have tried changing the PATH variable and JAVA_HOME variable to point to the same dir - but I still get the same result using the java -version command - 1.5.0.16 etc.
    – Vidar
    Sep 29, 2010 at 12:26

4 Answers 4

8

You need to reset your path variable to point to 1.6

something like
alt text

Additionally, make sure the variable JAVA_HOME is also set with the above location.

16
  • My Java_Home and my Path Varaible point to the java version 1.6.0_19, but in the cmd java -version shows me java version 1.6.0_20. Because i made an update via the java-Updater?
    – cuh
    Sep 29, 2010 at 11:09
  • @cuh java-Updater !! interesting, how ? which O.S. ? Sep 29, 2010 at 11:10
  • Windows 7. In the jre/bin Directory start Java Control Panel: javacpl. you can (de-)activate automatic update notifications. My Path points to jdk 1.6.0_19 but java in cmd is linked to the jre6 version 1.6.0_20.
    – cuh
    Sep 29, 2010 at 11:26
  • @cuh: Is there is a java (a different one) in your system folder by any chance?
    – Sagar V
    Sep 29, 2010 at 11:27
  • 1
    @Vidar I would strongly recommend you to simply delete that dir, and install it from standard setup. Sep 29, 2010 at 13:44
6

JAVA_HOME is used by other applications, such as Tomcat. Windows just checks the PATH environment variable for locations where it can find the java executable.

0
0

Try this on the cmd shell:

> java -version
java version "1.5.0_16"
> set PATH=%JAVA_HOME%\bin;%PATH%
> java -version
3
  • 3
    That wouldn't work since you are appending %JAVA_HOME%\bin after the existing path list - Windows will still find the older java.exe first. Should be set PATH=%JAVA_HOME%\bin;%PATH% instead. Sep 29, 2010 at 11:12
  • 1
    @Peter, agree, didn't pay attention, the old Java was on the path so it has to be added at the beginning for this demo. But obviously, replacing the old entry is the norma solution ;) Sep 29, 2010 at 11:27
  • Yes indeed. Btw I wasn't the downvoter - I think your demo idea is good and this issue is trivial to fix. Sep 29, 2010 at 11:31
0

This Image will explain all steps. enter image description here

For More Explanation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.