3

I have been searching for this. All the related Java APIs are worked on images. They get the information from barcode contained in the images and print barcode to images.

My question is how to get the barcode directly from the scanner in Java? Is there any API I am missing to read barcode directly from scanner? Or, whether I need to generate in-memory image from the information got by the scanner?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Sanjeev
  • 397
  • 1
  • 8
  • 20

2 Answers2

1

AFAIK, most of barcode scanners have keyboard emulation mode. You can attach scanner to your PC, scan the barcode and scanner will provide you with barcode information emulating ordinary keypresses which you can capture in any acceptable way (e.g. as keypresslistener or inputfield in Java Swing)

Konstantin V. Salikhov
  • 4,554
  • 2
  • 35
  • 48
0

Most of modern barcode scanners can be set up to work in serial emulation mode. If you set them up this way, you can communicate with the device as if you are communicating with a normal serial port (read/write). Then you can use a Java library for communicating with the serial device. I used a library called RxTx (http://rxtx.qbang.org/wiki/index.php/Main_Page) which worked great both on Windows and on Linux.