JNI学习—Q&A:Linux加载动态库报错:java.lang.UnsatisfiedLinkError: only ET_DYN and ET_EXEC can be loaded

幸福,只不过是想让快乐有一个存在下去的理由。

Q(问题):

JNI学习—Q&A:Linux加载动态库报错:java.lang.UnsatisfiedLinkError: only ET_DYN and ET_EXEC can be loaded

A(解决):

编译源文件生成so文件时,命令不对。

原命令:

gcc -I /opt/jdk/jdk1.8.0_231/include -I /opt/jdk/jdk1.8.0_231/include/linux -fPIC -shared -o /opt/jni/ClassLoader.so  -c /opt/jni/classloader.cpp

改为:不要-c

gcc -I /opt/jdk/jdk1.8.0_231/include -I /opt/jdk/jdk1.8.0_231/include/linux -fPIC -shared -o /opt/jni/ClassLoader.so  /opt/jni/classloader.cpp 

 

上一篇:python+appium自动化测试-元素定位之android uiautomatorandroid


下一篇:VGGNet阅读笔记