Force Microsoft Java Machine

Hi, we just made a java applet that should run on IE with the microsoft virtual java machine.

The problem is that some clients can have a sun jvm, and in this case, the sun jvm takes precedence for all java execution.

I would like to have a method that would
a) allow me to detect which jvm is running,
b) allow me to run the MS virtual machines (when I want) without asking the user to uncheck his preferences
c) I also would like to know what risk I am taking if I allow some applets (or programs) to be running with the sun jvm, and at the same time my applet to be running with the ms jvm

Sincerely, Marc
Who is Participating?
Igor BazarnyConnect With a Mentor Commented:

As far as I know, there is no way to tell MSIE that it should use sun JVM for applets defined by <APPLET> tag. And vice versa, when you use <OBJECT> tag referring to Java plugin there is no way to run MS JVM. As for risks, watch news carefully--Microsoft once desided not to bundle JVM with WinXP.

You can find JVM version info from the system properties (call java.lang.System.getProperty() to access them) "java.vendor", "java.version" etc.

MS JVM is basically Sun's java 1.1.4 with few differences and some omissions (like RMI or newer JNI). Plus some Windows-specific extensions like COM support. I'm not sure that there is a big difference for unsigned applet. I remember one surprise I got when moved aplication from Sun to MS few years ago--MS BorderLayout does not accept null constraint, so it was necessary to update all places with explicit CENTER constraint.

In fact, I cannot imagine scenario when one or another jvm could take precedence. For applet, browser decides which JVM to run and IE runs MS JVM. For application, you use different executables to start different VMs--java for Sun and jview for MS JVM.

In any case, I would try to avoid MS JVM use, looks like they are going to drop java in favor of C#

Igor Bazarny,
Brainbench MVP for Java 1
I agree with Igor.

a) system properties

b) don't believe there is any way

c) none, in fact Sun's is a better JVM (IMO)
Igor BazarnyCommented:

Well, there is some risk of move from one VM to another because there are different bugs in different implementations. But in the long run if you want to stick with java, you'd better use Sun JVM. Note that Sun JVM is in version 1.4 now, while MS JVM corresponds to 1.1.4. And this is a really big difference.
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

MS also no longer ships its VM with XP.
mhervaisAuthor Commented:
Objects last remark is indeed questionning !!
Igor BazarnyCommented:
Well, Microsoft change their java mind too often. Now they are going to include JVM into XP Service Pack 1, but plan to stop JVM support in 2004. Instead, they will include java-like language (J#) support into Visual Studio .Net. It's unclear yet what J# means for applet developers.
Yes I just read that they had done an about face. Any idea what they are claiming the reason was for the change of heart?
Igor BazarnyCommented:
Sun sued them when they desided to remove JVM from XP.
hee hee :-)
> the sun jvm takes precedence for all java execution.

This is only the case if the user has requested it.
The user can specify which VM the browser should use by default to handle the <applet> tag.

So theoretically you could use a signed applet to modify the users settings before you load your applet. But I doubt many users would grant the applet permission to perform this task, and IMO doesn't gain you anything anyway.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.