Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
UnsatisfiedLinkError after building a JNI Library
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UnsatisfiedLinkError after building a JNI Library


 I'm trying to build a JNI library. My C code compiles fine, and when I add a main() method I can run it and it runs properly. But when I build it as a dynamic library, my java code won't load it. I'm getting an UnsatisfiedLinkError, even though I've verified the Library is on the load library path.

I suspect that java doesn't consider it a valid library. So when I give it an actual invalid library (an xml file that I've renamed to look like a library) I get exactly the same behavior, which supports my suspicions. So I assume I'm doing something wrong when I link my object files. Here's my link statement:

gcc  -g  -dynamiclib -framework JavaVM src/cReverse.o src/jni.o  -o out/production/Cjni/libCjni.jnilib

(This is modified from a makefile generated by the alpha C++ plugin for the IntelliJ IDE.)

I'm calling System.loadLibrary("CjniLib") with a library file named "libCjniLib.jnilib", although when I try calling System.load(basePath + "libCjniLib.jnilib"), I still get the Error, without any explanation. (basePath is the absolute path to the file.)

Any suggestions? Thanks.

Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.