简体   繁体   中英

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

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 ?

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

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.

我有与CentOS 6.4类似的问题,解决方案是安装ia32-libs等价物(以root身份): yum install glibc.i686 libXext.i686 libXtst.i686

If you want to use 32-bit references, use the 64-bit JVM. It uses 32-bit references by default for up to 32 GB of memory (more than a 32-bit program can normally) from Java 6 update 23.

http://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html

@Hot Licks comments that the IBM JVM can access up to 68 GB with a "32/64 bit mode"

If you need to use more than this amount (or indeed anything like it), I would use off heap memory. This keeps full GC times under control and means you can always use 32-bit references.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM