现在我尝试编写一个使用Epson
Java Pos ADK的
Java应用程序.
我做了什么:
– 安装Java 1.6.0_22
– 安装Java JDK
– 安装Eclipse
– 安装了Epson Java Pos ADK 1.11.8
然后我用Com Port Tool尝试了我的打印机,我发给他十六进制字符,看看是否一切正常.它确实!
然后我开始开发我的应用程序.在jpos.xml中,我使用了Epson Java Pos ADK Package中的SetupPOS生成器.
我使用了几行来从我的应用程序中进行测试打印:
posPrinter = new POSPrinter();
posPrinter.open("##THE_NAME_I_SET_IN_JPOS_XML##");
posPrinter.claim(0);
posPrinter.setDeviceEnabled(true);
posPrinter.printNormal(station, "xxxxxxxxxxxxxxxxxx\n");
posPrinter.cutPaper(0);
posPrinter.release();
posPrinter.setDeviceEnabled(false);
posPrinter.close();
但这个应用程序的结果是:
jpos.JposException: It is not
initialized. at
jp.co.epson.upos.pntr.CommonPrinterService.checkInitialized(Unknown
Source) at
jp.co.epson.upos.pntr.CommonPrinterService.sendOutputData(Unknown
Source) at
jp.co.epson.upos.pntr.CommonPrinterService.sendOutputData(Unknown
Source) at
jp.co.epson.upos.pntr.CommonPrinterService.executeNormalPrint(Unknown
Source) at
jp.co.epson.upos.pntr.CommonPrinterService.printNormal(Unknown
Source) at
jpos.POSPrinter.printNormal(Unknown
Source) at
Printer.(Printer.java:146) at
Main.main(Main.java:28)
我在两台不同的PC(Vista和XP 32bit)上试用了相同的版本和工具,但它总是一样的.
我还尝试了JavaPos示例测试应用程序和EpsonHealtCheckTool.这个工具也是一样的.
不知道还有什么可以尝试,大家都知道这个问题吗?
PS:我的打印机Epson TM-U220A,串口连接似乎有效,因为当我尝试声明打印机而另一个应用程序使用COM端口时,我的应用程序说端口不可用.
谢谢.