JRE Switcher?
December 14, 2009 2:28 AM   Subscribe

What's the easiest way to switch between different JVMs?

I have some applications which unfortunately require specific versions of Java from different vendors - specifically IBM Java. I also need to use Sun Java.

Is there a way to define which version of Java an applet started from the browser calls? I looked for a Firefox extension but could find none.

Just to clarify: I'm not looking to switch between different versions of Sun Java, but between the Sun JRE, IBM JRE, etc.

Anything that makes the same easy for non-applets would also be useful (i.e. without creating custom .bat files)
posted by devnull to Computers & Internet (8 answers total) 3 users marked this as a favorite
It should be determined by which plug-in is installed and enabled in the browser. If you go to Tools -> Add-ons -> Plugins (assuming Fx 3.x) you should see the plug-in for whatever JRE is currently installed. You could try having both Sun and IBM JREs install their plug-ins and then disable one or the other to switch between which one is active. You'll have to restart the browser each time though, and prior to Fx 3.x there was no easy way to disable a plug-in, so if you are using an older version you'd need to do it by renaming away the plug-in's loadable library (.dll/.so/whatever your OS calls it.)
posted by Rhomboid at 3:39 AM on December 14, 2009

Thanks. I need to use different JVMs in the same browser, i.e. per site or per tab.
posted by devnull at 3:53 AM on December 14, 2009

to clarify, are you looking for some way of having the browser prompt the user which JVM/release they want each applet launched in, or do you want to do something like <PARAM name="JVM" value="sun_1_5">?
posted by russm at 3:56 AM on December 14, 2009

Oh. Well I wouldn't get your hopes up, as that sounds extremely hard to pull off from a technical standpoint. You'd have to essentially write a third party plug-in that installs in Firefox in place of the JVMs' plug-ins and then instantiates and proxies all the API calls to the actual plug-ins. I wouldn't be surprised to learn that at the plug-in API level there's no way to determine which tab a request corresponds to, just the window-id/handle of the control/client area (meaning it would be impossible to tell the difference between two objects in the same page vs. two objects in different tabs.)
posted by Rhomboid at 4:11 AM on December 14, 2009

I am with Rhomboid, java gets initialized when firefox starts up. The best option may be run a couple of different vm's using virtualbox or something to test that have different java plugins configured.
posted by dyno04 at 5:42 AM on December 14, 2009

I don't think you can have 2 different JVM running in the same browser.
(I remember wrestling with various Oracle JVM a couple of years ago - wasn't fun)

A couple of options I see:
- Have a small, universal applet checking which version of Java is running and then loading an applet compiled for this JVM (or instructing the users to change their settings)

- Use jnlp to launch one of the apps

Also, theoratically, you could run IETab in Firefox, or Google Frame in IE and set them up to use a different JVM - but I'm unsure how you'd call it.
posted by motdiem2 at 6:32 AM on December 14, 2009

why not use something like Portable Firefox installed twice (this means "unzip the zip file twice") and then install a JVM into each? I'm not sure if that'll work, but I think it might - the portable version of it is supposed to be totally self-contained.
posted by mrg at 9:44 AM on December 14, 2009

what OS are you on? On *nix (Linux, OSX) variants, this can be easily accomplished by installing seperate copies of the browser and configuring each copy to use a different version of the JVM. Each can be running, and are completely isolated from each other.

Oh, i see you say .bat files... so you're on Windows. Might still be possible, don't know.
posted by at at 12:21 PM on December 14, 2009

« Older Before there was www   |   help me find a cool clock Newer »
This thread is closed to new comments.