views:

265

answers:

1

I was trying to run a project in my local machine.

I tried to load this jnilib file which I got from a running instance of this project on my Mac 10.6.2,

System.load(lib.getAbsolutePath());

then I got this exception thrown:

java.lang.UnsatisfiedLinkError, mach-o but wrong architecture

I have check the jnilib with file command:

libScreenMatchProxy.jnilib: Mach-O dynamically linked shared library i386

I guess this is because the jnilib file is compiled in 32bit but the Java comes with Mac10.6 is 64bit. So I go to Java Preference and set Java to use 32bit first. But it didn't work.

As mentioned above, this jnilib file is copied from a running instance of the project on my Mac, so it should work. I don't understand why it working in the installed application but not in my Eclipse.

A: 

Adding "-d32" to the VM argument from Run Configuration will force Eclipse to call Java in 32bit mode. That will solve this problem.

Yinan