Skip to main content


A scanner example program for Datalogic JavaPOS

BarCodeReaderExample outputs barcode data until you press enter to exit. BarCodeReaderExample runs with Datalogic JavaPOS. The latest release of JavaPOS can be downloaded from the Datalogic website here.

The BarCodeReaderExample repository contains the source and shell scripts to run the BarCodeReaderExample.jar you build. The repository also has a NetBeans IDE (Integrated Development Environment) project to perform the build. Other IDEs can be used.

Steps to build and run BarCodeReaderExample.jar:

  1. Install Datalogic JavaPOS. This install includes the JavaPOSTest program.

  2. Make sure Datalogic JavaPOS runs with your scanner. With your scanner and JavaPOSTest do an Open, Claim, Enable and then scan a barcode. Assuming the barcode type (UPC-A, QR Code, .etc,) is enabled on the scanner it should read the barcode.

  3. Clone or download the BarCodeReaderExample repository.

  4. Build BarCodeReaderExample.jar. This was originally done with the following. Variations near these should work.

    • Apache NetBeans 11.0
    • Java jdk1.8.0_231
    • The BarCodeReaderExample project in NetBeans is a Java with Ant, Java Application project. The build uses a library of the JavaPOS's .jar files. These .jar files are in the JavaPOS install's root directory where it has its JavaPOS.jar and its SupportJars directory. Create this library via NetBeans -> Tools -> Libraries. Add the library to the BarCodeReaderExample NetBeans project via its Properties -> Libraries -> Classpath + -> Add Library...

    Another variation here builds BarCodeReaderExample.jar without requiring the Apache NetBeans 11.0 Integrated Development Environment (IDE). It instead builds with the included script BuildBarCodeReaderExample.cmd or These scripts explicitly use the Java JDK's javac and jar programs and require no intermediary IDE. Related "inside" scripts show what is inside BarCodeReaderExample.jar and Datalogic's JavaPOS.

  5. Update the jpos.xml of your installed JavaPOS to include a <JposEntry logicalName="DatalogicJavaPOSDevice"> entry for your scanner and interface. This entry is a copy of the entry you used with JavaPOSTest above. The only difference is the logicalName is changed to DatalogicJavaPOSDevice.

  6. With BarCodeReaderExample make your scanner read. Use the appropriate BarCodeReaderExample script: