Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 指定pos打印机中setBitmap()方法的文件路径_Java_Image - Fatal编程技术网

Java 指定pos打印机中setBitmap()方法的文件路径

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

我正在尝试使用以下代码将图像打印到pos打印机

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()