Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java 7 64 bit on windows 7: how to switch java versions

I need to switch from the installed java 7 at 64bit to the installed java 6 on my Windows 7 64bit OS but the usual procedure doesn't works. I tried to change the JAVA_HOME environment variable but when I type java -version, the system replies Java 7... How can I switch from different java versions?

Thank you.

like image 692
AndyPower Avatar asked Sep 05 '11 13:09

AndyPower


People also ask

How can I change Java 8 to Java 17?

bat and add this file location in your machine's Path environment variable. So now SJV will act as command to "Switch Java Version". Now open new command window and just type SJV 11 it will switch to Java 11. Type SJV 8 it will switch to Java 8.


2 Answers

You need to switch the path environment variable too, to point before to the JRE bin directory. Also, I think modern versions of java place a copy of "java.exe" in the system32 directory of Windows, you'll need to remove them (or rename them, if you want to keep them as backups).

like image 52
Sirs Avatar answered Sep 24 '22 23:09

Sirs


JAVA_HOME is not used by java.exe.

Make sure to have the path of the Java 6 JRE's bin directory in the PATH environment variable, before the Java 7 JRE's one, and before windows system directory (system32).

Or you can use the full path of the java command:

c:\java6\bin\java com.foo.bar.Main
like image 29
JB Nizet Avatar answered Sep 25 '22 23:09

JB Nizet