2 回答
TA贡献1851条经验 获得超4个赞
再看了下问题,貌似不是这个原因。可能需要你帖点代码出来才晓得了
下面的东西先留着,等找到真正的原因了再来改吧
看样子是 DLL 没加载到,JNA 的文档里有设置路径的办法
Make your target library available to your Java program. There are several ways to do this:
The preferred method is to set the jna.library.path system property to the path to your target library. This property is similar to java.library.path, but only applies to libraries loaded by JNA.
Change the appropriate library access environment variable before launching the VM. This is PATH on Windows, LD_LIBRARY_PATH on Linux, and DYLD_LIBRARY_PATH on OSX.
Make your native library available on your classpath, under the path {OS}-{ARCH}/{LIBRARY}, where {OS}-{ARCH} is JNA's canonical prefix for native libraries (e.g. win32-x86, linux-amd64, or darwin). If the resource is within a jar file it will be automatically extracted when loaded.
大概就是需要你把 DLL 所在目录设置在系统的 PATH 路径里,或者通过 java 的参数 jna.library.path
指定目录,
java -Djna.library.path=PATH_TO_YOUR_DLL ClassName
添加回答
举报