我买了一台爱普生T88IV热敏打印机。我使用安装手册安装了爱普生JavaPOS ADK。
然后,我在Eclipse中从爱普生JavaPOS的lib文件夹中添加了Jar文件,并编写了一个连接到打印机的简单程序。
public class MainClass {
public static void main(String[] args)
{
//System.out.println("Ausgabe aus der main()-Methode");
POSPrinterControl113 ptr = (POSPrinterControl113)new POSPrinter();
try {
//Open the device.
//Use the name of the device that connected with your computer.
ptr.open("EPSON_TM_T88IV");
//Get the exclusive control right for the opened device.
//Then the device is disable from other application.
ptr.claim(1000);
//Enable the device.
ptr.setDeviceEnabled(true);
}
catch(JposException ex) {
}
}
}但我收到了这些错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jp_co_epson_upos_firm_FirmNativeAccess_1_13_0001 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at jp.co.epson.upos.core.v1_13_0001.pntr.CommonPrinterService.<clinit>(CommonPrinterService.java:1004)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at jp.co.epson.uposcommon.util.EpsonJposServiceInstanceFactory.createInstance(EpsonJposServiceInstanceFactory.java:142)
at jpos.loader.simple.SimpleServiceConnection.connect(Unknown Source)
at jpos.BaseJposControl.open(Unknown Source)
at MainClass.main(MainClass.java:15)可以用"CheckHealth.bat“打印一些东西。
有人想办法解决这个问题吗?
诚挚的问候
米因泽尔马森
发布于 2014-06-24 07:16:24
java.lang.UnsatisfiedLinkError意味着Java无法找到所需的系统库。在本例中,“系统库”指的不是jar库。“系统库”是指操作系统的库文件(Windows上的DLL)。
您需要更改路径变量(在Windows上),并添加存储所需爱普生JavaPOS DLL的正确目录。或者,您也可以在使用"-Djava.library.path“参数启动Java应用程序时设置正确的路径,例如:
java.exe -Djava.library.path=c:\path\to\dlls\ -cp c:\my\class\path my.app.Main编辑
您需要指定的路径是存储DLL jp_co_epson_upos_firm_FirmNativeAccess*.dll的目录。爱普生JavaPOS ADK的安装例程将这些文件存储在安装ADK时指定的JRE的bin目录中。
发布于 2014-03-28 21:26:45
您只需要在类路径中包含带有爱普生驱动程序文件(jp_co_epson_upos_firm_FirmNativeAccess_1_13_0001.XX)的dir,例如,您需要转到/home/username/..bash_profile并添加导出LD_LIBRARY_ path =/opt/EpsonJavaPOS/bin
https://stackoverflow.com/questions/21465607
复制相似问题