Java 指定pos打印机中setBitmap()方法的文件路径
我正在尝试使用以下代码将图像打印到pos打印机Java 指定pos打印机中setBitmap()方法的文件路径,java,image,Java,Image,我正在尝试使用以下代码将图像打印到pos打印机 String spath = "E:\\javapos\\javapos.bmp"; System.out.println("***************" + spath); ptr.setBitmap(1, POSPrinterConst.PTR_S_RECEIPT, spath, (ptr.getRecLineWidth() / 2), POSPrinterConst.PT
String spath = "E:\\javapos\\javapos.bmp";
System.out.println("***************" + spath);
ptr.setBitmap(1, POSPrinterConst.PTR_S_RECEIPT, spath,
(ptr.getRecLineWidth() / 2),
POSPrinterConst.PTR_BM_CENTER);
这在IDE中工作得很好,但是当我将它编译到jar时,它会给我一个错误。
错误如下:
jpos.JposException: Could not create an image object with JAI.
at jp.co.epson.upos.core.v1_14_0001.pntr.CommonPrinterService.setMemoryImage(CommonPrinterService.java:7506) at jp.co.epson.upos.core.v1_14_0001.pntr.CommonPrinterService.setBitmap(aCommonPrinterService.java:6611) at jpos.POSPrinter.setBitmap(Unknown Source)
at possystem.MainInterface.initPrinter(MainInterface.java:2354)
at possystem.MainInterface.checkOut(MainInterface.java:1960)
at possystem.MainInterface.jTextField23KeyPressed(MainInterface.java:175
非常感谢您的帮助。我解决了这个问题。问题不在于路径,而在于我没有为Java运行时引擎安装JAI。我为我的JRE安装了JAI,现在它运行良好。
谢谢大家的帮助。变量的类型是什么
ptr
?它指向一个PosPrinter对象<代码>POSPrinterControl114 ptr=(POSPrinterControl114)新POSPrinter()你有这个类的源代码吗?没有,我只有编译过的代码。试试IntelliJ IDEA的反编译器。它的输出更具可读性。