2 回答

TA貢獻1770條經(jīng)驗 獲得超3個贊
再看了下問題,貌似不是這個原因??赡苄枰闾c代碼出來才曉得了
下面的東西先留著,等找到真正的原因了再來改吧
看樣子是 DLL 沒加載到,JNA 的文檔里有設(shè)置路徑的辦法
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 所在目錄設(shè)置在系統(tǒng)的 PATH 路徑里,或者通過 java 的參數(shù) jna.library.path
指定目錄,
java -Djna.library.path=PATH_TO_YOUR_DLL ClassName
添加回答
舉報