可可dylib上的JNI System.LoadLibrary失败 [英] JNI System.LoadLibrary failed on Cocoa dylib
本文介绍了可可dylib上的JNI System.LoadLibrary失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按照JNI指南,我使用Xcode创建了一个dylib(在Objective-C中),并希望像下面那样将其加载到我的Java项目中,
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)
如何解决此问题?
推荐答案
使用System.load尝试了库的完整路径,并且可以正常工作.
Tried using the System.load with full path to the library and it worked.
这篇关于可可dylib上的JNI System.LoadLibrary失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文