Posts Tagged ‘mac’

Loading JNI libraries on the Mac

Monday, January 18th, 2010

I’ve been trying to build a simple JNI library from C code on the Mac (Snow Leopard). Compiling it seems pretty straightforward, but the Java library loader isn’t happy. I can call

System.load("/tmp/jnitest.jnilib");

which works fine, or

System.loadLibrary("jnitest")
// or
System.loadLibrary("jnitest.jnilib")

with java.library.path set to “/tmp”, which doesn’t work.

I’ve given up trying to understand it for now. I spent way too long googling on the Intertubes for information, which points to problems with Java 1.6 on Snow Leopard, but I didn’t find anything that was even consistent with this behavior. On the other hand, I can at least make progress for the moment, since the JNI calls work.