开发者

What's the trick to get JNA to interface with 3rd party DLLs?

开发者 https://www.devze.com 2023-03-25 12:55 出处:网络
I\'m getting the following error when trying to interfac开发者_运维知识库e with a Magtek 32-bit DLL.

I'm getting the following error when trying to interfac开发者_运维知识库e with a Magtek 32-bit DLL.

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Unable to load library 'MCPAPI': The specified module could not be found.

I have no problem interfacing with user32.dll in the same code (just tweaking the DLL name and interface). Seems to indicate that the DLL can't be found, but it's most definitely in my jna.library.path. I've even gone as far as dumping it into the Windows system directory, next to user32, without success.

What am I missing here?


jna.library.path will only influence loading of libraries directly referenced. Dependent libraries must be found either in the same directory as the explicitly loaded one, or in PATH.

For your example to work, MCPAPI must be in either jna.library.path or PATH, and its dependent libraries must be either in the same directory or in PATH.


If you run a 64bit jvm you cannot load 32bit dll's. If thats the case, install 32bit jvm


try using System.load(path\to\library) instead System.loadLibrary().

0

精彩评论

暂无评论...
验证码 换一张
取 消