问题
I am trying to execute a JNI call on a 64 bit linux machine but the library is only supported on a 32 bit machine. Can I force my 64 bit linux to use a 32 bit jvm? when I type java -d32 version, I get the message "Running a 32 bit jvm is not supported this platform".
I would like to know how to install a 32 bit jvm on the 64 bit machine so I can get my native library to work
回答1:
It appears that you cannot typically have both 64 bit and 32 bit JDK on the same Linux system (according to Oracle). If you uninstall the 64 bit and install the 32 bit using the Synaptic Package manager or by downloading from Oracle, you should be fine.
Unfortunately I'm at work and don't have my Ubuntu machine with me to test.
回答2:
You can download a tar.gz file for 32 bits java from java.com, extract it to wherever you want, export JAVA_HOME with the new path.
As an example, this is want I did and worked for me when I was trying to run a 32bit application on a 64 bit machine:
- Downloaded jre-7u40-linux-i586.tar.gz from java.com.
- Extracted jre-7u40-linux-i586.tar.gz to /opt/jre1.7.0_40
- Created a shell script to run my application with these lines before starting the application:
export JAVA_HOME=/opt/jre1.7.0_40
# optional:
export PATH=$JAVA_HOME/bin:$PATH
来源:https://stackoverflow.com/questions/9512603/installing-32-bit-jvm-on-64-bit-linux