开发者

LoadLibrary can't find .dll in NetBeans

开发者 https://www.devze.com 2023-03-23 07:30 出处:网络
I trying to load SFmpq.dll via this code static { Native.setProtected(true); System.setProperty(\"jna.library.path\",

I trying to load SFmpq.dll via this code

static {
    Native.setProtected(true);
    System.setProperty("jna.library.path",
            new File("lib").getAbsolutePath());
    System.out.println(System.getProperty("jna.library.path"));
    INSTANCE = (SFmpq)   Native.loadLib开发者_JAVA百科rary("SFmpq", SFmpq.class);
}

It gets executed, Folder and File exist but I still get this error:

C:\Users\Frotty\Documents\NetBeansProjects\Optimizer\lib Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Unable to load library 'SFmpq': The specified module could not be found.

I gave the code and .dll a friend of mine who imported it into Eclipse and there it worked perfectly fine. Can anyone spot my mistake or how do I import .dlls correctly?


You can get this error if you try to load a 32 bit library on a 64 bit system.


I've had success with using System.load(...) and System.loadLibrary(..) to load dlls

0

精彩评论

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

关注公众号