What happens when you insall JVM 1.5 and 1.6? or 1.4 and 1.5?

Java sets a JAVA_HOME environmental variable in your system, but what if you don't want the "active" JVM to always be the latest installed? Well, you will find the solution here !

First of all, let me explain to you what seems to happen in the latest version of the Java Installer. It seems that, Java is also installing itself into the %WINDOWS%\System32 folder and thus overwrites the ugly Microsoft Java that usually causes unexpected behaviour in other programs. This is a good thing you say, but now, when you try to change the path content of the JAVA_HOME variable to put the "active" JVM to another version, why does it not change as it should? (See Figure Above)

The reason is simple. This what part of your PATH environmental variable could look like. %SystemRoot%\system32;%SystemRoot%;%JAVA_HOME%;

The problem with this is that Windows searches through all the pathes for a java.exe until it finds one. And it stops at the first it finds. You already see the problem? Regardless of what you put in JAVA_HOME, Windows will ALWAYS stop looking for a java.exe file right after %SystemRoot%\system32.

If however, you put %JAVA_HOME% before %SystemRoot%\system32 the problem is fixed!! So now, your PATH should contain amongst others these elements in THIS order.

%JAVA_HOME%;%SystemRoot%\system32;%SystemRoot%;

From now on, you can just switch the active JVM's by simply changing the JAVA_HOME env variable !!

Leave your comments and thoughts please.

Cheers,

4 comments

Comment from: Wookai [Visitor] · http://20-100.ch/blog
Buuuuuu !

Where are the explainations ?
02/26/08 @ 15:27
Comment from: Trefex [Member]
Well the picture is not visible. So the explanations will come when that is fixed :)
02/26/08 @ 15:28
Comment from: Wookai [Visitor] · http://20-100.ch/blog
Great post tref, I think it will be helpful to a lot of people ;) !
02/27/08 @ 10:30
A-ha! Cool :D
Very useful post :)
02/27/08 @ 10:31

This post has 1 feedback awaiting moderation...

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)