Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had installed jdk-6u18-windows-i586 on my machine. Later on I uninstalled it and installed jdk 1.5.0_13 instead.

Now when I do javac -version I get

jdk 1.5.0_13

But when I do java -version I get

java version "1.6.0_19"

How do I fix this?

share|improve this question

migrated from Apr 6 '10 at 11:39

This question came from our site for professional and enthusiast programmers.

what is under c:\program files\Java ? – Bozho Apr 6 '10 at 11:09
Your question is better suited for – Daniel A. White Apr 6 '10 at 11:10
@Bozho jdk1.5.0_13 and lots of jre installations – Jack Apr 6 '10 at 11:12
one of which is, I guess, 1.6.0_19 – Bozho Apr 6 '10 at 11:13
No I have jre1.5.0_12 , 0_13, 0_15, jre6 – Jack Apr 6 '10 at 11:15

Remove the java s/w in the registers by going the "regedit" from the run command. Later u install the jdk 1.5.0_13 of java it will work.

share|improve this answer

Multiple JREs and JDKs can be installed on one machine. You are having JDK 1.5, but you have JRE 1.6.0_19.

And the version that is called from command line depends on the environment variables. Go and check your environment variables. check PATH, JAVA_HOME, JRE_HOME.

share|improve this answer
My JAVA_HOME is set to C:\Program Files\Java\jdk1.5.0_13...I dont have a JRE_HOME environment variable – Jack Apr 6 '10 at 11:18
@Jack - check PATH – Bozho Apr 6 '10 at 11:24

As the others have suggested, it looks like you have the 1.6 Java runtime hanging around.

Check your PATH and you should see the JRE location.

Assuming you don't need it any more, go to Control Panel | Add or Remove Programs and delete the unwanted JRE (which will have the Java icon and J2?? Runtime Enviroinment in its name).

share|improve this answer

Which Java is called when you do java -version is controlled exclusively by the PATH; the first java.exe that can be reached from the PATH will be.

Other than trying to do a more clean "uninstall," what you can do is modify your PATH (in System|Properties...) to point first to the Java that you want called.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .