Java Eclipse中的DLL加载库错误

时间:2013-11-26 10:53:03

标签: java dll java-native-interface

我想将DLL用于FiscalPrinter,我将empifis.dll放在jre6/bin文件夹中,并在Java程序中调用DLL代码,如下所示,

CLibrary INSTANCE = (CLibrary)Native.loadLibrary("empifis",                              CLibrary.class);

它抛出错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'empifis': The specified module could not be found.

at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:145)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188)
at com.sun.jna.Library$Handler.<init>(Library.java:123)
at com.sun.jna.Native.loadLibrary(Native.java:255)
at com.sun.jna.Native.loadLibrary(Native.java:241)
at org.compiere.pos.Main$CLibrary.<clinit>(Main.java:15)
at org.compiere.pos.Main.main(Main.java:35)

2 个答案:

答案 0 :(得分:0)

也许您需要提供文件扩展名.dll?

你也可以把它放在存储大多数dll的系统文件夹中。或者您添加环境变量的路径。

答案 1 :(得分:0)

将dll添加到ClassPath 我认为这就是你looking for