jna 报错 java.long.UnsatisfiedLinkError uable to load library

小wei 发布于 2014/01/17 09:44
阅读 3K+
收藏 0

项目中要运用到jna,因为我在linux下作开发所以c++生成的是.so文件。

我写了一个类 里面写了一个interface 在接口中调用native.loadlibrary() 方法 并且在它下边写了so文件中的方法。

我在main方法里调用,出现标题提示的错误,是不是so文件路径不对呢?

在native.loadlibrary 下边写的方法中的变量应该是写c++中的变量还是java中的变量呢?

so文件放到/usr/lib 这招没起效果



具体错误如下:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'D:\STDSApi': Native library (win32-x86-64/D:\STDSApi.dll) not found in resource path ([file:/F:/work/webService/WebRoot/WEB-INF/classes/, file:/D:/Program%20Files%20(x86)/myeclipse/Common/plugins/com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321/data/libraryset/EE_5/javaee.jar, file:/D:/Program%20Files%20(x86)/myeclipse/Common/plugins/com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321/data/libraryset/EE_5/jsf-impl.jar, file:/D:/Program%20Files%20(x86)/myeclipse/Common/plugins/com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321/data/libraryset/EE_5/jsf-api.jar, file:/D:/Program%20Files%20(x86)/myeclipse/Common/plugins/com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321/data/libraryset/EE_5/jstl-1.2.jar, file:/F:/work/webService/WebRoot/WEB-INF/lib/jna-4.0.0.jar, file:/F:/work/webService/WebRoot/WEB-INF/lib/webservices-api.jar, file:/F:/work/webService/WebRoot/WEB-INF/lib/webservices-extra-api.jar, file:/F:/work/webService/WebRoot/WEB-INF/lib/webservices-extra.jar, file:/F:/work/webService/WebRoot/WEB-INF/lib/webservices-rt.jar, file:/F:/work/webService/WebRoot/WEB-INF/lib/webservices-tools.jar, file:/D:/Program%20Files%20(x86)/myeclipse/MyEclipse%2010/configuration/org.eclipse.osgi/bundles/16/1/.cp/data/1.2/lib/antlr.jar, file:/D:/Program%20Files%20(x86)/myeclipse/MyEclipse%2010/configuration/org.eclipse.osgi/bundles/16/1/.cp/data/1.2/lib/commons-beanutils.jar, file:/D:/Program%20Files%20(x86)/myeclipse/MyEclipse%2010/configuration/org.eclipse.osgi/bundles/16/1/.cp/data/1.2/lib/commons-digester.jar, file:/D:/Program%20Files%20(x86)/myeclipse/MyEclipse%2010/configuration/org.eclipse.osgi/bundles/16/1/.cp/data/1.2/lib/commons-fileupload.jar, file:/D:/Program%20Files%20(x86)/myeclipse/MyEclipse%2010/configuration/org.eclipse.osgi/bundles/16/1/.cp/data/1.2/lib/commons-logging.jar, file:/D:/Program%20Files%20(x86)/myeclipse/MyEclipse%2010/configuration/org.eclipse.osgi/bundles/16/1/.cp/data/1.2/lib/commons-validator.jar, file:/D:/Program%20Files%20(x86)/myeclipse/MyEclipse%2010/configuration/org.eclipse.osgi/bundles/16/1/.cp/data/1.2/lib/jakarta-oro.jar, file:/D:/Program%20Files%20(x86)/myeclipse/MyEclipse%2010/configuration/org.eclipse.osgi/bundles/16/1/.cp/data/1.2/lib/struts.jar])
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
    at com.sun.jna.Library$Handler.<init>(Library.java:147)
    at com.sun.jna.Native.loadLibrary(Native.java:412)
    at com.sun.jna.Native.loadLibrary(Native.java:391)
    at com.huadi.jaxws.TestJna$CLibrary.<clinit>(TestJna.java:12)
    at com.huadi.jaxws.TestJna.main(TestJna.java:22)

以下是问题补充:

@小wei:十万火急啊 (2014/01/20 10:30)
加载中
0
情天大圣
情天大圣

linux下怎么会出现windows路径和windows库呢?win32-x86-64/D:\STDSApi.dll

OSCHINA
登录后可查看更多优质内容
返回顶部
顶部