问题
I am building a desktop Java application. It uses a third party framework for some low level work (it is in C and I have used JNA).
On my Windows Machine, when I do Native.loadLibrary("EDSDK.dll", EdSdkLibrary.class, options);
it works perfectly well. On Mac when I try to do Native.loadLibrary("EDSDK.framework", EdSdkLibrary.class, options);
it threw UnsatisfiedLinkError
saying: mach-o, but wrong architecture
My java 7 version is 64 bit and the framework is 32 bit based. On a different mac containing Java6, when I ran Java in 32 bit mode, the application works well. This confirms the exception thrown was because of 32 bit incompatibility and I need to use 32 bit only(which is obvious).
This is the irritating part- In Java 7, -d32
option doesn't work and Oracle no longer gives Java 7 in 32 bit. How do I run my Java 7 in 32 bit so that I can use the third party framework? Open JDK? Or use Java 6 and use it in 32 bit mode. But Oracle no longer provides Java 6 for Mac.
Any other alternative??
回答1:
You can download the Apple Java 6 JDK, which does include a 32 bit JVM. But I doubt there will be much in the way of future security updates for Java 6, so you would be better off getting hold of a 64 bit version of the native framework and using that with Oracle Java 7.
来源:https://stackoverflow.com/questions/15111743/java-7-to-be-run-in-32-bit-on-mac