java -Djava.library.path=. TestJNI
>>>>
Exception in thread "main" java.lang.UnsatisfiedLinkError: TestJNI.calibrate([D[DII)[D
at TestJNI.calibrate(Native Method)
at TestJNI.main(TestJNI.java:61)
I know the library is getting loaded otherwise the error says cant find calibrate library. what does the above error mean?
我知道图书馆正在被载入否则错误说找不到校准图书馆。上面的错误是什么意思?
EDIT
编辑
this is my implementation-
——这是我实现
JNIEXPORT jdoubleArray JNICALL Java_TestJNI_cailbrate (JNIEnv * env, jobject jobj, jdoubleArray rtt, jdoubleArray distance ,jint activecount,jint passivecount) {
jdoubleArray jresult = (*env)->NewDoubleArray(env,3);
.......
return jresult;
}
are the parameters declared correctly?
参数声明正确吗?
2 个解决方案
#1
7
This message means that Java is looking for a native method that looks like the Java method
这条消息意味着Java正在寻找一个与Java方法相似的本机方法
double[] calibrate(double[], double[], int, int)
If you have generated your header files correctly, and built the library, this most likely means you are missing the implementation of that method.
如果您已经正确地生成了头文件并构建了库,这很可能意味着您丢失了该方法的实现。
Some things that come to mind:
我想到了一些事情:
- Did you rebuild the library after you implemented the method?
- 在实现该方法之后,您重新构建了库吗?
- Did you happen to change the interface of the Java method after you built the library?
- 在构建库之后,您是否碰巧更改了Java方法的接口?
#2
1
Another cause of this cryptic error is when you import the incorrect <jni.h>
file. For instance, if you are compiling against x86 but point your includes
path to the x64 flavor of the header.
这个神秘错误的另一个原因是当您导入不正确的
#1
7
This message means that Java is looking for a native method that looks like the Java method
这条消息意味着Java正在寻找一个与Java方法相似的本机方法
double[] calibrate(double[], double[], int, int)
If you have generated your header files correctly, and built the library, this most likely means you are missing the implementation of that method.
如果您已经正确地生成了头文件并构建了库,这很可能意味着您丢失了该方法的实现。
Some things that come to mind:
我想到了一些事情:
- Did you rebuild the library after you implemented the method?
- 在实现该方法之后,您重新构建了库吗?
- Did you happen to change the interface of the Java method after you built the library?
- 在构建库之后,您是否碰巧更改了Java方法的接口?
#2
1
Another cause of this cryptic error is when you import the incorrect <jni.h>
file. For instance, if you are compiling against x86 but point your includes
path to the x64 flavor of the header.
这个神秘错误的另一个原因是当您导入不正确的