LoadLibrary can't find .dll in NetBeans
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
精彩评论