Barcode Reader API for Java

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

Java Barcode Reader SDK

To add a dependency using Maven:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <repositories>
    <repository>
      <id>dbr</id>
      <url>https://download.dynamsoft.com/maven/dbr/jar</url>
    </repository>
  </repositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <groupId>com.dynamsoft.demo</groupId>
  <artifactId>BarcodeReaderDemo</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>BarcodeReaderDemo</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.dynamsoft</groupId>
      <artifactId>dbr</artifactId>
      <version>6.2</version>
    </dependency>
  </dependencies>
</project>

Example code:

import com.dynamsoft.barcode.jni.BarcodeReader;
import com.dynamsoft.barcode.jni.TextResult;
import java.nio.file.Path;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        String path = System.getProperty("user.dir");
        Path p = Paths.get(path, "images", "test.jpg");
        try {
            BarcodeReader reader = new BarcodeReader(
                    "<Your trial license>");
            TextResult[] results = reader.decodeFile(p.toString(), "");
            for (TextResult result : results) {
                System.out.println(result.barcodeText);
            }
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println(e);
        }

    }
}

License

Apply for a trial license.

Try for Free

Subscribe Newsletter

Subscribe to our mailing list to get the monthly update.

Subscribename@email.com