Windows 中 Epson POS 打印机的 JPOS 配置问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3241087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:49:46  来源:igfitidea点击:

JPOS Configuration Problems for an Epson POS printer in Windows

javawindowsepsonjavapos

提问by Tiago Alves

I'm trying to print using jPOS in Windows and get the following exception:

我正在尝试在 Windows 中使用 jPOS 进行打印并得到以下异常:

jpos.JposException: Could not connect to service with logicalName = Printer: Exception.message=jp.co.epson.uposcommon.util.EpsonJposServiceInstanceFactory
    at jpos.loader.simple.SimpleServiceConnection.connect(Unknown Source)
    at jpos.BaseJposControl.open(Unknown Source)
...

More information:

更多信息:

I'm trying to port our Java printing software from Linux (where it works well) to Windows. We are using an Epson TM-T70 receipt printer. I installed the regular printer drivers and was immediately able to print stuff using notepad, for instance.

我正在尝试将我们的 Java 打印软件从 Linux(它运行良好)移植到 Windows。我们使用的是 Epson TM-T70 收据打印机。例如,我安装了常规打印机驱动程序,并立即能够使用记事本打印内容。

Now I installed the Epson JavaPoS ADK. I configured the printer using the SetupPOS application that comes with the ADK. I created a new configuration for my printer with Logical Device Name "Printer". I saved everything and it created the jpos.xml file.

现在我安装了 Epson JavaPoS ADK。我使用 ADK 附带的 SetupPOS 应用程序配置了打印机。我使用逻辑设备名称“打印机”为我的打印机创建了一个新配置。我保存了所有内容并创建了 jpos.xml 文件。

When I try run our application and it executes printer.open("Printer") where "Printer" is the logical device name and printer is a POSPrinter instance, I get the exception above.

当我尝试运行我们的应用程序并执行 printer.open("Printer") 其中“Printer”是逻辑设备名称而打印机是 POSPrinter 实例时,我得到了上面的异常。

I know that my generated jpos.xml file is being used because if I provide a random logical device name, I get a different exception.

我知道我生成的 jpos.xml 文件正在被使用,因为如果我提供一个随机的逻辑设备名称,我会得到一个不同的异常。

I guess the problem is in the port configuration of SetupPOS. The printer is connected through USB. I tried the Port name that appears in the windows printer properties (ESDPRT001) and I even tried all combiniations of COM1 to COM10 but nothing works.

我猜问题出在SetupPOS的端口配置上。打印机通过 USB 连接。我尝试了出现在 Windows 打印机属性 (ESDPRT001) 中的端口名称,我什至尝试了 COM1 到 COM10 的所有组合,但没有任何效果。

Does anyone have some suggestion? Thanks!

有人有什么建议吗?谢谢!

回答by Steffen

The Installation Routine of the Epson JavaPOS ADK is ... ahm ... let me say: "very special". So the Installation copies some jar files (like epsonupos.jar, jposXXX.jar and some more) in the ext/lib Directory of the JRE (!!!) (which must be selected while installing the JavaPOS Driver). We had also some very strange effects if we install another JavaPOS Version, switching to another JRE/JDK, using other Printers which are not from Epson or somthing else.

Epson JavaPOS ADK 的安装程序是……嗯……让我说:“很特别”。所以Installation会在JRE的ext/lib目录下复制一些jar文件(如epsonupos.jar、jposXXX.jar等)(!!!)(安装JavaPOS驱动时必须选择)。如果我们安装另一个 JavaPOS 版本,切换到另一个 JRE/JDK,使用不是来自 Epson 或其他东西的其他打印机,我们也会产生一些非常奇怪的效果。

May be your problem is a result of any conflicts between different jar Version or JDK's or somthing else ...

可能是您的问题是不同 jar 版本或 JDK 或其他版本之间的任何冲突的结果...

EDIT:

编辑:

Since ADK Version 1.11.anywhat (not realy sure, but I mean 1.11.9) you can specify the path in which the additional jar files are stored. But: Some DLL's will be also in the currently newest ADK Version (1.13.17) stored into the bin directory of the selected JRE. May be this is also a conflict between different Versions of used jar's and used DLLs or something else ...

从 ADK 版本 1.11.anywhat(不太确定,但我的意思是 1.11.9)开始,您可以指定存储其他 jar 文件的路径。但是:某些 DLL 也将在当前最新的 ADK 版本 (1.13.17) 中存储到所选 JRE 的 bin 目录中。可能这也是不同版本的使用过的 jar 和使用过的 DLL 或其他东西之间的冲突......

回答by Daniel Maia

I Solved this adding the following library paths to java project:

我解决了这个问题,在java项目中添加了以下库路径:

C:\Program Files\EPSON\JavaPOS\lib

C:\Program Files\EPSON\JavaPOS\lib

C:\Program Files\EPSON\JavaPOS\SetupPOS

C:\Program Files\EPSON\JavaPOS\SetupPOS

回答by Marcelo P. Llanos C.

With javaPOS 1.14.6, on Debian 9 Linux I solved with LD_LIBRARY_PATH:

使用 javaPOS 1.14.6,在 Debian 9 Linux 上我使用 LD_LIBRARY_PATH 解决了:

$ export LD_LIBRARY_PATH = /opt/EpsonJavaPOS/bin && javapos_application_to_run

On windows 10 copy:

在 Windows 10 上复制:

BluetoothIO.DLL
epsonjpos.dll
EthernetIO31.DLL
SerialIO31.dll
USBIO31.DLL

from C:\Program Files\EPSON\JavaPOS\bin\

C:\Program Files\EPSON\JavaPOS\bin\

to C:\Program Files\Java\jre1.8.0.171\bin\

C:\Program Files\Java\jre1.8.0.171\bin\

Run javaPOS application.

运行 javaPOS 应用程序。

回答by Siberia

I know is a little late for response but may help others with similar problems. In my case i am interacting with a Data logic Scanner using javapos, and i was having this message: ERROR: Failed to open DL-Magellan-9400i-USB-OEM-Scanner-Scale profile, jpos.JposException: Could not connect to service with logicalName = DL-Magellan-9400i-USB-OEM-Scanner-Scale: Exception.message=com.dls.jpos.service.DLSScannerInstanceFactory

我知道回复有点晚,但可能会帮助其他有类似问题的人。就我而言,我正在使用 javapos 与数据逻辑扫描仪进行交互,并且收到此消息:错误:无法打开 DL-Magellan-9400i-USB-OEM-Scanner-Scale 配置文件,jpos.JposException:无法连接到服务逻辑名称 = DL-Magellan-9400i-USB-OEM-Scanner-Scale: Exception.message= com.dls.jpos.service.DLSScannerInstanceFactory

i started looking in the javapos software that downloaded from datalogic and found that there was a jar file that was not included in my classpath (JavaPOS.jar) and that was why i was getting the error, take a look netx image:

我开始查看从 datalogic 下载的 javapos 软件,发现有一个 jar 文件没有包含在我的类路径 (JavaPOS.jar) 中,这就是我收到错误的原因,看看 netx 图像:

JavaPOS.jar file content

JavaPOS.jar 文件内容

I wanted to share in case someone has same issues. (Took me almost 2 days to get it done!!)

我想分享,以防有人遇到同样的问题。 (我花了将近 2 天的时间才完成!!)