These instructions are mainly inspired by the how-to “Ubuntu 9.10 64bit and custom 32bit JDK and Eclipse 3.5 pwned” on http://blog.javaee.cz/2009/11/ubuntu-910-64bit-and-custom-32bit-jdk.html.
These instructions were developed originally for Ubuntu Linux 9.10 Karmic Koala.
Download the latest JDK 6 (currently JDK 6 update 18) for Linux 32bit platform from http://java.sun.com/javase/downloads/widget/jdk6.jsp. You need to pick the file without the “-rpm” suffix as we want to put all files in one directory instead of spread this 32bit stuff all around in our 64bit system. Also, installing RPMs in distributions that use the Debian package format does not work that well in most times …
(1) Create the directory /usr/local/lib/jvm/ and unpack your Java 6 SDK in this directory:
This will create a sub-directory jdk1.6.0_18.
(2) Create a symlink named “java” to the SDK’s directory, as this is “good style”:
ln -s /usr/local/lib/jvm/jdk1.6.0_16 /usr/local/lib/jvm/java/;
(3) Create a file /etc/profile.d/setup-dev-env.sh that sets up environment variables for the Java development environment we set up here, for every user. Content for this file:
(4) Install Eclipse 3.5. 32bit into /usr/local/share/applications/eclipse-3.5.1-32bit/:
tar -xzf /some/dir/eclipse-java-3.5.1-linux-32bit-gtk.tar.gz;
mv eclipse eclipse-3.5.1-32bit;
ln -s ../share/applications/eclipse-3.5.1-32bit/eclipse eclipse-32bit;
(5) We will not use the update-java-alternatives command to select this Java SDK installation for running Eclipse, instead adapt eclipse.ini ton include a modified -vm argument like this, in two lines directly before the “-vmargs” line:
(6) Eclipse 32bit and a 32bit JDK for it is now installed. You can test it by running the eclipse-32bit executable.
(7) There is a bug in Eclipse 3.5 (except when it comes with the distro, where the bug is already corrected), due to a change in GTK, that prevents clicking most buttons. You have to highlight them with the mouse and then press enter to trigger them. To fix this, replace the symbolic link /usr/local/bin/eclipse-32bit with an executable file of the following content:
# Custom startup script for Eclipse 4.5 to correct the “non-clickable buttons” found there.
(8) To prevent linkage error when linking to the SWT platform plugins from this Eclipse 32bit platform (or for other kinds of reasons, as you chose to set up a 32bit Eclipse), you will want to let all the Eclipse RCP applications you develop also run with a 32bit JDK. You cannot use the “-vm /usr/local/lib/jvm/java/bin/java” argument in the “Arguments” tab of the Eclipse run configuration here; it is ignored because you the Execution Environment / JRE setting on the “Main” tab is used instead. So configure this to use your 32bit VM in /usr/local/lib/jvm/java/bin/java.
(9) If you see an error “org.eclipse.swt.SWTError: No more handles” when running Eclipse, there is a fix for that in our source http://blog.javaee.cz/2009/11/ubuntu-910-64bit-and-custom-32bit-jdk.html.