Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a 32bit JVM on a 64bit Linux?

Tags:

I'm trying to run a 32bit Hotspot JVM on a 64bit Debian Mint machine. At first sight it all works until you'll try to run something using Swing:

java.lang.UnsatisfiedLinkError: /opt/javadev/jdk1.7.0_03_32b/jre/lib/i386/xawt/libmawt.so:   
libXext.so.6: cannot open shared object file: No such file or directory

Adding that to the library path: export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu.

But then it gives this error:

java.lang.UnsatisfiedLinkError: /opt/javadev/jdk1.7.0_03_32b/jre/lib/i386/xawt/libmawt.so: 
libXext.so.6: wrong ELF class: ELFCLASS64

Any idea what else has to be done here ?

like image 939
Jan Goyvaerts Avatar asked Feb 22 '12 11:02

Jan Goyvaerts


2 Answers

To be able to use the 32-bit JVM, you'll need to have the 32-bit compatibility libraries installed. The second error message means that the 32-bit JVM process is trying to load a 64-bit library; that doesn't work.

On Ubuntu you'd have to install the package ia32-libs, which contains the 32-bit compatibility libraries for 64-bit Ubuntu.

UPDATE: Ubuntu 13.10 introduced multi-arch which replaced ia32-libs with libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386. Source: https://stackoverflow.com/a/10473415/14731

like image 117
Jesper Avatar answered Oct 09 '22 21:10

Jesper


I just had the same issue on Ubuntu 14.04, where I wanted to keep my 32-bit Oracle Java on a 64-bit install. ia32-libs is gone since Ubuntu 13.10, and now the glib answer is "just download the i386 libraries that you need". Unfortunately, there doesn't seem to be an easy way to find out which libraries those are.

The simple remedy is to install 32-bit OpenJDK as

sudo apt-get install openjdk-7-jdk:i386

That pulls in a large number of i386 libraries. You can uninstall the OpenJDK again if you like, but I left it in place so I don't accidentally autoremove the libraries.

Put Oracle JDK on the PATH, and now Eclipse and NetBeans will start up fine.

like image 22
cayhorstmann Avatar answered Oct 09 '22 21:10

cayhorstmann