现在的位置: 首页 > 综合 > 正文

JNA异常java.lang.UnsatisfiedLinkError: Unable to load library处理方法

2012年06月13日 ⁄ 综合 ⁄ 共 345字 ⁄ 字号 评论关闭
interface HelloDll extends Library {
HelloDll INSTANCE
= (HelloDll)Native.loadLibrary("driver/helloDll", HelloDll.class);
public void hello();
}
通常我们在使用JNA的时候会使用类似上面的方式(假设DLL名为helloDll.dll)
1. 在这种情况下,我们需要将helloDll这个文件拷贝到driver目录下。
2. 同时为了跨平台,相对路径应该这么写:
"driver" + File.separator + "helloDll"

3. 另外,如果helloDll.dll依赖其他包的话,也要将包拷贝到driver目录下或是系统路径。查看dll依赖关系的工具很多,google一下就行了。

抱歉!评论已关闭.