You could probably read data directly from any USB scanner (without the serial port emulation that this model has) by doing some intensive JNI coding but I wasn't prepared to take the time to work out the native code. I also setup the program to pass any unrecognized barcode scans to the keyboard (any barcode that my app did not create - I used a distinct signature on my barcodes) this was so it would work as a regular barcode scanner for any other apps that might read barcodes from the keyboard.
My java program reads all input from the specified serial port and writes the barcode to a database. For me, this was much better than a keyboard hook to get the barcode data because the program does not need the focus before being able to interpret a scan (I would not want to create a global keyboard hook). This model has a setting to emulate a serial port, you can then read the scanned data using the m package. I used Honeywell Voyager MS9540 USB barcode scanner.Īs a default the scanner sent the data straight as keyboard input - no driver required.īut it was very easy to get this model to interact directly with java rather than using a keyboard hook (to use the barcodes as variables in java, as you mentioned). I recently had to implement a scanner system to interact with java.