【问题标题】:JavaPOS - Epson TM-T88IV - UnsatisfiedLinkError in EclipseJavaPOS - Epson TM-T88IV - Eclipse 中的 UnsatisfiedLinkError
【发布时间】:2014-01-30 19:21:01
【问题描述】:

我买了一台 Epson TM-T88IV 热敏打印机。我使用安装手册安装了 Epson JavaPOS ADK。

然后我在 Eclipse 中添加了 Epson JavaPOS 的 lib 文件夹中的 Jar-Files,并编写了一个连接到打印机的简单程序。

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”打印一些东西

有人有解决这个问题的想法吗?

最好的问候

梅因泽尔梅亨

  • 我使用的是 Windwos 8.1(64 位)
  • 热敏打印机通过 USB 连接
  • EPSON JavaPOS ADK 的版本是 1.13.15
  • 已安装最新的 32 位 Java 版本的 Java JDK 和 JAI

【问题讨论】:

    标签: eclipse printing unsatisfiedlinkerror epson javapos


    【解决方案1】:

    java.lang.UnsatisfiedLinkError 表示Java 找不到需要的系统库。 “系统库”在这种情况下意味着不是 jar 库。 “系统库”是指操作系统的库文件(Windows上的DLL)。

    您需要更改(在 Windows 上)PATH 变量并添加存储所需 Epson 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 的存储目录。 Epson JavaPOS ADK 的安装例程将这些文件存储到您在安装 ADK 时指定的 JRE 的 bin 目录中。

    【讨论】:

      【解决方案2】:

      您只需将带有 epson 驱动程序文件 (jp_co_epson_upos_firm_FirmNativeAccess_1_13_0001.XX) 的 dir 包含到类路径中,例如在 centos 中,您需要转到 /home/username/.bash_profile 并添加 export LD_LIBRARY_PATH=/opt/EpsonJavaPOS/bin

      【讨论】:

        猜你喜欢
        • 2014-08-21
        • 1970-01-01
        • 2018-10-30
        • 2014-03-17
        • 2018-12-26
        • 2012-05-16
        • 1970-01-01
        • 2018-05-01
        • 1970-01-01
        相关资源
        最近更新 更多