2 回答

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個(gè)贊
再看了下問(wèn)題,貌似不是這個(gè)原因。可能需要你帖點(diǎn)代碼出來(lái)才曉得了
下面的東西先留著,等找到真正的原因了再來(lái)改吧
看樣子是 DLL 沒(méi)加載到,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 路徑里,或者通過(guò) java 的參數(shù)?jna.library.path
?指定目錄,
java?-Djna.library.path=PATH_TO_YOUR_DLL?ClassName
添加回答
舉報(bào)