问题
I have a requirement where I need to connect to a POS printer from a Java Swing App. What I came to know that there's a standard called Java POS to achieve this.
Now the problem is on java POS website (http://www.javapos.com/) I did not find anything that is helpful in getting me started.
I checked Java POS simulators (https://code.google.com/p/pos-device-simulator) but the thing is, even if I start that successfully I get no clue what to do, how to test any code against these simulators.
Can someone guide me in the right direction? Where to begin my quest about using Java POS connect to a POS Printer and then print some data successfully?
回答1:
I just started on the same quest and I think that the best way to do is to grab yourself a receipt printer from a well-known vendor such as Epson or Star Micronics. They normally provide enough documentation on to get started on the whole process. The device simulator is too complex and seems to be a bit buggy in my opinion.
Assuming that you managed to get yourself a printer, here's you'll need to do:
- Generate a jpos.xml containing device specific information. The vendor should have a program which can generate this information for you.
- Modify the jpos.properties under $jpos.jar/jpos/res to point it to the location of your jpos.xml. Note: Your vendor tool may do this automatically for you.
- Add all the necessary libraries
- Start on the sample codes provided by your vendor
The somewhat incomplete documentation of JavaPOS can be found as part of the UPOS documentation in Appendix B located at http://www.nrf-arts.org/content/unifiedpos Also, the latest programming guide on JavaPOS that I found is here: http://www.javapos.com/downloads/javaPOSv1.4.pdf
Hope this helps.
回答2:
"I wonder when JavaPOS was written as a standard, why it was not considered to implement a Printer query mechanism so that one could just query the underlying system registry and find any conneccted JavaPos device. Do you have any idea how to do the above? I don't think it's implemented. For end user running a utility to generate a jpos.xml and then modify the files/cofniguration does not make any sense to me. – Alam Sher Sep 22 at 8:21 "
Generally on Pos system, peripherals are connected to serial ports and are not declared in os (microsoft, linux, ires ...). In many pos system, constructor provide their own implementation and tools for javapos (like ibm, toshiba ... http://www-01.ibm.com/support/docview.wss?uid=pos1R4000014) to help you to discover wich device is connected and build your jpos.xml.
来源:https://stackoverflow.com/questions/18881347/getting-started-with-java-pos-development