问题
following JNI guidelines, I created a dylib (in Objective-C) using Xcode and expected to load it in my Java project, like the following does,
public class Main {
private native void done();
public static void main(String[] args) {
New Main().done();
}
static {
System.loadLibrary("Test");
}
public Main() {
super();
}
and I am getting the following runtime error -
Exception in thread "main" java.lang.UnsatisfiedLinkError: no Test in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at Main.<clinit>(Main.java:27)
How could I get this fixed?
回答1:
Tried using the System.load with full path to the library and it worked.
来源:https://stackoverflow.com/questions/6255710/jni-system-loadlibrary-failed-on-cocoa-dylib