java.lang.UnsatisfiedLinkError中 [英] java.lang.UnsatisfiedLinkError
问题描述
java.lang.UnsatisfiedLinkError中
java.lang.UnsatisfiedLinkError
我使用的是HELLO-JNI的例子,不管是什么原因,我得到一个java.lang.UnsatisfiedLinkError中,当我尝试打电话给HELLO-JNI库。任何想法,为什么?我一定要在某处设置我的路径?
I'm using the hello-jni example, and for whatever reason, I'm getting a java.lang.UnsatisfiedLinkError when I try to call the hello-jni library. Any ideas why? Do I have to set my path somewhere?
在HelloJni.java:
in HelloJni.java:
public native String stringFromJNI();
和
static {
System.loadLibrary("hello-jni");
}
在HELLO-jni.c:
in hello-jni.c:
jstring
Java_com_bdunlay_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
jobject thiz )
{
return (*env)->NewStringUTF(env, "Hello from JNI !");
}
中的.so文件是... project_root /库/ armeabi / libhello-jni.so
the .so file is... project_root/libs/armeabi/libhello-jni.so
推荐答案
本机没有JNIEXPORT。它通常声明中头文件与函数声明。
your native have no JNIEXPORT. It usually declares in header file with function declaration.
我们将使用javah的-jni生成标题
We will use javah -jni to generate the header
这篇关于java.lang.UnsatisfiedLinkError中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!