How to Use Java Barcode Reader API

Dynamsoft’s Barcode Reader SDK is a cross-platform bar code detection and decoding library. With the barcode scanning SDK, developers could easily build Java barcode applications on Windows, Linux, and macOS.

The Complete SDK Package

Get 30-day free trial of Dynamsoft Barcode Reader SDK >

Java Barcode SDK

Java Barcode Quick Start

A dynamsoft-barcodereader-7.5.jar file is located under the Dynamsoft Barcode Reader\lib folder. You can easily import the jar file to your Java IDE (e.g. Eclipse). If you are using a Maven project, to add the dependency, you need to edit the pom.xml file as follows:

 <repositories>
    <repository>
         <id>dbr </id>
         <url>https://download2.dynamsoft.com/maven/dbr/jar </url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.dynamsoft</groupId>
        <artifactId>dbr</artifactId>
        <version>7.5.0</version>
    </dependency>
</dependencies> 

Here is the code snippet showing how to decode barcodes from an image file:

import com.dynamsoft.barcode.*;

public class App {
    public static void main(String[] args) {
        String filename = "<file path>";
        try {
            BarcodeReader reader = new BarcodeReader(
                    "<Your trial license>");
            TextResult[] results = reader.decodeFile( filename, "");
            for (TextResult result : results) {
                System.out.println(result.barcodeText);
            }
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println(e);
        }

    }
}

For more advanced usage, please read the online documentation.

API Reference

https://www.dynamsoft.com/help/Barcode-Reader-Java/index.html

SDK License

To fully experience the functionalities of the SDK, please get a valid trial license.

Samples

Get more Java barcode scanning samples >

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe Newsletter

Subscribe to our mailing list to get the monthly update.

Subscribename@email.com