Wednesday, September 28, 2011

Run 32bit Java Apps on 64bit Linux With a Second JVM

So yesterday I ran into an application I wanted to run that required a 32bit JVM to operate without errors. Since I'm running 64bit Ubuntu Linux and I've (obviously) got a 64bit JVM installed, that meant getting a second JVM installed and running the app with that JVM instead of the system default one. Bit of a problem when you don't want to switch the system default JVM just to run one app, but there's a way around that.


Basically I just followed the instructions posted here.

In short, all you do is install a new 32bit JVM, make sure that the default on your system is still set to your 64bit copy, and then create a shell script for each 32bit Java app you want to run so that it uses the newly install 32bit JVM instead of the default 64bit one. Simple, right?

For the app I needed to run, I created a shell script that looked like this -

#!/bin/sh
appnamehere -vm /usr/lib/jvm/ia32-java-6-sun/bin/java

- and set it to executable and it ran as expected. Not being enough of a Java person to know, I can't say if the -vm option works for all Java apps or not.

Fortunately there shouldn't be too many more Java apps that require a 32bit JVM going forward. I've only got the one app that needed this hack, and I don't expect to run into any more any time soon.

No comments:

Post a Comment