Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.UnsatisfiedLinkError: edu.hit.ir.ltp4j.SRL.sr #38

Open
tonyliangli opened this issue May 29, 2018 · 2 comments
Open

java.lang.UnsatisfiedLinkError: edu.hit.ir.ltp4j.SRL.sr #38

tonyliangli opened this issue May 29, 2018 · 2 comments

Comments

@tonyliangli
Copy link

MacOS 10.13.4系统下运行srl demo提示:
java.lang.UnsatisfiedLinkError: edu.hit.ir.ltp4j.SRL.srl(Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;)
请问如何解决?谢谢!

@tonyliangli
Copy link
Author

其他的接口均正常,使用git submodule init和git submodule update提供的ltp无法顺利编译,出现大量error,故使用ltp最新的master替换submodule中的ltp,可以顺利编译,但是只有srl接口无法正常使用,提示如上错误。

@tonyliangli
Copy link
Author

已解决。

ltp4j/src/main/c++/edu_hit_ir_ltp4j_SRL.cpp文件中的JNIEXPORT jint JNICALL Java_edu_hit_ir_ltp4j_SRL_srl中的第二个参数应该是jobject obj而不是jclass obj。否则不能和ltp4j/src/main/java/edu/hit/ir/ltp4j/SRL.java中的public final native int srl对应上。jclass是静态的,而java文件中的srl方法不是静态方法。

使用objdump -t libltp4j-0.1.0-SNAPSHOT.jnilib | grep Java_edu_hit_ir_ltp4j_SRL才调试出来的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant