Java的JNI错误java.lang.UnsatisfiedLinkError中:XXXX()V [英] Java JNI error java.lang.UnsatisfiedLinkError: xxxx()V
问题描述
我有一个粗略的时间 JNI
今天,基本上是我想要做的就是整合 OpenAlpr
我的的Java
项目中,我使用precompiled二进制文件,当我运行 java_test.bat
文件,这工作完全。在第一个Java不停地告诉我,它无法找到 openAlprJni
然后我加入了路径的dll
我的构建路径和系统路径,在这之后我就开始经历了 openAlprJni.Alpr.initialize(Ljava /朗/字符串; Ljava /朗/字符串; Ljava /朗/字符串;)V
这根据文件意味着库本身是不正常的,但它是确定,因为测试程序运行过程中,我已经看过各种论坛,甚至跟 OpenAlpr
的作者,但仍然无法解决这个问题,有没有人在这里谁拥有了类似的问题,帮我解决这个问题?先谢谢了。
I have had a rough time with JNI
today, basically what I want to do is integrate OpenAlpr
to my Java
project, I am using precompiled binaries which work perfectly when I run the java_test.bat
file. At first Java kept on telling me it could not locate openAlprJni
then I added the path to the dlls
to my build path and system path, after which I started experiencing the openAlprJni.Alpr.initialize(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
which according to documentation means the library itself is not ok, but it is ok since the test program is running, I have looked at various forums and even talked to the author of OpenAlpr
but still cannot resolve this issue, is there anybody here who has had a similar problem help me fix this? thanks in advance.
推荐答案
请在<一看href=\"https://github.com/openalpr/openalpr/blob/master/src/bindings/java/src/com/openalpr/jni/Alpr.java\"相对=nofollow> com.openalpr.jni.Alpr 。在第12行找到:
Please have a look in com.openalpr.jni.Alpr. In line 12 you find:
private native void initialize(String country, String configFile, String runtimeDir);
此方法匹配于头部 com_openalpr_jni_Alpr.h :
/*
* Class: com_openalpr_jni_Alpr
* Method: initialize
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_openalpr_jni_Alpr_initialize(JNIEnv *, jobject, jstring, jstring, jstring);
您将看到你正在体验只是这个初始化
的方法签名方法,它返回无效
和一个类型的三个参数 Ljava /朗/字符串;
You will see that what you are "experiencing" is just the method signature of this initialize
method which returns void
and takes three parameters of type Ljava/lang/String;
.
您可能爆发的例子,当你添加到您的工作空间(检查包名)。请注意,在* .DLL你正在使用很可能对编制 com_openalpr_jni_Alpr
,而不是 jni_Alpr
。
You probably broke the examples when you added it into your workspace (check the package names). Please be aware, the *.dll you are using was probably compiled against com_openalpr_jni_Alpr
and not jni_Alpr
.
我认真地建议你去学习JNI的概念,这里一>你找到一个很好的起点。
I seriously recommend you to learn JNI concepts, here you find a good starting point.
这篇关于Java的JNI错误java.lang.UnsatisfiedLinkError中:XXXX()V的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!