Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes How can i read barcode through java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How can i read barcode through java" Watch "How can i read barcode through java" New topic
Author

How can i read barcode through java

Naveen Kumar
Ranch Hand

Joined: Dec 14, 2006
Posts: 35
Hi

Any Body Could you please help me.
How can i read barcode through java in swing.

Regards
Naveen
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

This *can* be done in Java - but it has nothing to do with Swing directly.

You're going to have to read from the bar-code scanner somehow - Serial Port, USB, Parallel Port - whatever. The link gives some libraries that you will need to interface with however your specific device connects. Once you figure out how to connect to your device, you're going to need to figure out how your device communicates barcodes - again specific to the device.

Once you have a way to talk to the device connection, and a way to figure out how the device is sending you barcode information - *THEN* you're going to use Swing to write the GUI.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Typically what I've seen is that the scanner devices utilizes a native driver on the OS and all the scanner really does is spit the bar code info out to whatever focused text component there is. This could be Notepad, Word, Excel, or your swing app. So you might check that as well.


GenRocket - Experts at Building Test Data
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41532
    
  53
Some libraries you may find useful when showing/generating barcodes are iText (creates PDF files containing barcodes) and barcode4j and jbarcodebean (both on SourceForge) for creating images of barcodes.


Ping & DNS - my free Android networking tools app
Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
Yup I worked on a Java Point of Sale application that used a bar code reader. The bar code reader basically went between the keyboard and the computer and sent the bar code in as text. There are of course other bar code readers including serial port models. We actually had magnetic strip readers too and they also came in via the keyboard.

The bar code scanner came with software to produce the bar codes to put on products so we didn't need to produce or consume bar code images in Java. Just decide on the bar code number, put it in the DB for the product, print bar codes using software, bar code comes in as text from the keyboard, compare against DB.
Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
Once you have a way to talk to the device connection, and a way to figure out how the device is sending you barcode information - *THEN* you're going to use Swing to write the GUI



I have done this but am having difficult integrating the class that reads the data with the gui.
[ May 24, 2008: Message edited by: FERNANDO HOOD ]
bart zagers
Ranch Hand

Joined: Feb 05, 2003
Posts: 234
Originally posted by Gregg Bolinger:
Typically what I've seen is that the scanner devices utilizes a native driver on the OS and all the scanner really does is spit the bar code info out to whatever focused text component there is. This could be Notepad, Word, Excel, or your swing app. So you might check that as well.


I have the same experience with barcode scanners. We even have developed a web application. Each scan is just put to whatever focused text component there is, just as it would come from the keyboard.
We have never written anything that "gets" the data, the scanner always "pushes" it to the application.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i read barcode through java