Barcode Xpress for Java v13.5 - Updated
Try the Sample Application
Getting Started > Try the Sample Application

Try the Sample Application

Hello Barcode Xpress for Java

Hello Barcode Xpress for Java is a simple barcode reading sample hosted on GitHub to demonstrate how easy it is to read barcodes from your images with Barcode Xpress:

Read Barcodes

The code sample is located in the "samples" sub-folder located at Accusoft/BarcodeXpressJava13-64/samples. It also contains the ReadMe.txt file with detailed instructions on how to build and run the samples.

Please refer to the How to Build and Run Samples section below for information on building the sample.

Barcode Xpress for Java has the following sample to get you started:

ReadBarcodes

Recognizes the text in an image(s) and prints results to the console.

How to Build and Run Samples

The commands to compile and run the sample will essentially be the same on both Windows and Linux. The only difference is the punctuation mark used to separate entities on the classpath. Java uses ";" on Windows and ":" on Linux.

Using Maven

  1. Navigate to the sample folder. For example, for the ReadBarcodes sample use the following command:

    cd Accusoft/BarcodeXpressJava13-64/samples/ReadBarcodes
    
    
  2. In the sample folder, run the following command:

    mvn clean package dependency:copy-dependencies
    
    

    After the command has successfully completed, the "target" folder will be created in the sample folder.

  3. Run the sample with the following command:

    Linux

    mvn exec:java -Dexec.args="path/to/your/image.bmp"
    or
    java -cp "target/ReadBarcodes-1.0.jar:target/dependency/barcodexpressjava-13.5.jar" ReadBarcodes path/to/your/image.bmp
    
    

    Windows

    mvn exec:java -Dexec.args="path/to/your/image.bmp"
    or
    java -cp "target/ReadBarcodes-1.0.jar;target/dependency/barcodexpressjava-13.5.jar" ReadBarcodes path/to/your/image.bmp
    
    

Manual Compliation

  1. Navigate to the samples folder.
    For example, for the ReadBarcodes sample use the following command:

    cd Accusoft/BarcodeXpressJava13-64/samples/ReadBarcodes
    
    
  2. In the sample folder, compile the sample using the following command:

    Linux

    javac -cp ".:src/main/java:../../bin/barcodexpressjava-13.5.jar" src/main/java/ReadBarcodes.java
    
    

    Windows     

    javac -cp ".;src/main/java;../../bin/barcodexpressjava-13.5.jar" src/main/java/ReadBarcodes.java
    
    
  3. Run the sample using the following command:

    Linux

    java -cp ".:src/main/java:../../bin/barcodexpressjava-13.5.jar" ReadBarcodes path/to/your/image.bmp
    
    

    Windows

    java -cp ".;src/main/java;../../bin/barcodexpressjava-13.5.jar" ReadBarcodes path/to/your/image.bmp
    
    

Running the Sample with Arguments

The ReadBarcodes sample allows you to specify the type of barcode to search. So, if you want to look for only 1D barcodes, only 2D barcodes, or all types of barcodes, use the type option to specify it.

Usage

ReadBarcodes [options] <image1> [<image2> ... <imageN>]

Options

-t, --type <type>

(optional = true, default = '1d') Barcode types to scan  
<type>: '1d' - all 1D | '2d' - all 2D | 'all' - all 1D + 2D | you can also specify several barcode types at once

-h, --help

(optional = true) Print this help message

Examples

ReadBarcodes ../images/Barcode-All-Supported-Types.bmp ../images/Barcode-Multiple-Common.bmp

ReadBarcodes -t 1d -t Planet --type ADD2 ../images/Barcode-All-Supported-Types.bmp

ReadBarcodes -t 2d ../images/Barcode-All-Supported-Types.bmp

ReadBarcodes --type all ../images/Barcode-*

Using an IDE

  1. Open IntelliJ IDEA
  2. Open the folder "Accusoft/BarcodeXpressJava13-64/samples"
  3. Click the build icon in IntelliJ IDEA
  4. Add a new configuration and select Application
  5. Name Your configuration
  6. Set the module to the version of Java you're using to compile and run
  7. Set the classpath to ReadBarcodes
  8. Set the main class to ReadBarcodes
  9. Set the program arguments to the path to the image
  10. Save the configuration and run the sample with the new configuration

Configuration Example