Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For normal development I'm using the 64-bit VM which comes when I install the Java development kit (OpenJDK) with the package manager.

But there are some Java applications (containing native libraries, I suppose) which don't work on a 64 bit Java VM. (Looks like SoapUI is such a candidate - in version 4.0.1 and 4.5 beta 1, it fails with a segmentation fault if run in a 64 bit VM.)

I tried to install the i386-version of openjdk-6-jre in addition to the 64-bit one, but this is refused by aptitude (saying that it conflicts with the existing 64-bit version). The same happens if I try to install openjdk-jre-7 in the 32-bit version.

An answer to Can I run a Java 32-bit application on a 64bit system proposed to install ia32-sun-java6-bin, but there is no package with this name (or anything with ia32 and Java).

What could I do here to run SoapUI without switching my whole system Java installation to 32 bit?

share|improve this question
I actually managed to run soapUI with the 64-bit version by editing the shell script to pass some different parameter. I'll have to look up What exactly I did. – Paŭlo Ebermann Jun 8 '12 at 19:53
See… for installing both 64 bit and 32 bit java from the repositories. You can change the default too. – user68186 Jan 7 '14 at 16:09

It's super easy to have multiple versions of Java installed. Somewhat harder (read: tedious) is switching between versions at a whim.


  1. apt-get one
  2. untar the other
  3. export paths depending which one you want

apt-get one version

Decide which version you'll mostly be using. Or decide which one you want to have automatic updates. Or flip a coin, whatever. You don't even have to use apt-get; just manually maintain both packages on your system (see next heading).

The point is: it's easier to use Ubuntu's package manager to maintain exactly one version of a package like java. You're gonna take care of the rest.

untar the other

Download a jdk tarball. Extract it to /opt.

switch between them

I let the package manager handle my primary install. I export some vars for the other one when I need it. I work on the command line a lot, so it's an okay solution for me. I bother with:

export JAVA_HOME=/opt/jdk
export PATH=$JAVA_HOME/bin:$PATH

Also, I symlink jdk/ -> jdk1.6.0_3/ because I'm lazy and don't like reconfiguring my .bashrc and other scripts every incremental jdk upgrade.

Environment variables you might care about:

share|improve this answer
Couldn't you just as well get the .deb for the other architecture instead of the tarball? – 0xC0000022L Feb 21 '13 at 2:45
@0xC0000022L The idea is that you contain each version to its own directory. If you can do that with a deb, great! – djeikyb Feb 21 '13 at 16:33


First, download the latest 32 bit JDK (not JRE) from Sun. At the time this was jdk-6u7-linux-i586.bin for me.

Install java-package:

sudo apt-get install java-package 

Now use java-package to build a .deb package from the binary you downloaded. You have to trick it into building the 32 bit package:

DEB_BUILD_GNU_TYPE=i486-linux-gnu DEB_BUILD_ARCH=i386 fakeroot make-jpkg jdk-6u7-linux-i586.bin 

This should generate a .deb package. For some reason the package name has the _amd64 suffix. Install the package:

sudo dpkg -i sun-j2sdk1.6_1.6.0+update7_amd64.deb 

Use update-alternatives to select the new JDK. It was installed at /usr/lib/j2sdk1.6-sun for me.

sudo update-alternatives --config java 

If you run java -version you should see the correct version:

java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode)

32 bit Eclipse

I had to reinstall the 32 bit version of Eclipse (since SWT contains native code). I also had to delete my ~/.eclipse directory or Eclipse wouldn’t start (this requires reinstalling new versions of any plugins). Finally, add the new JRE in Java->Installed JREs using the install location (/usr/lib/j2sdk1.6-sun) and select it as the default.


share|improve this answer
Thanks, I'll try this ... although I don't want the 32-bit one be the default, only use it for the few programs who don't work with 64 bit. – Paŭlo Ebermann Mar 7 '12 at 16:23

Or you can only install ia32-libs

 apt-get install ia32-libs

unzip the x86 jre

and add to PATH if you want to.

share|improve this answer
installing ia32-libs is not the recommended method on ubuntu-11.10 onward.… – m-ric Jan 7 '14 at 14:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.