How to Read Multiple Barcode and QR Code with Dynamsoft Java Barcode SDK

SDK Version


Supported Platforms

  • Windows (x86 and x64)
  • Linux (x64 and ARM64): PC, Raspberry Pi, Jetson Nano
  • macOS (x64)

Steps to Configure Java Barcode SDK with Maven

  1. Install Maven.
  2. Create a new Maven project via the command line:
mvn archetype:generate -DgroupId=com.dynamsoft -DartifactId=test -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
mvn package
java -cp target/test-1.0-SNAPSHOT.jar com.dynamsoft.App

Maven Configuration in Visual Studio Code

  1. Install the Maven extension:
"version": "0.2.0",
"configurations": [
"type": "java",
"name": "Debug (Launch) - Current File",
"request": "launch",
"mainClass": "${file}",
"args": "images/AllSupportedBarcodeTypes.png"
"type": "java",
"name": "Debug (Launch)-App<test>",
"request": "launch",
"mainClass": "com.dynamsoft.App",
"projectName": "test",
"args": "images/AllSupportedBarcodeTypes.png"

Implementing Multiple Barcode and QR Code Scanning in Java

import com.dynamsoft.dbr.*;
BarcodeReader br = null;
try {
br = new BarcodeReader();
} catch (Exception e) {
BufferedImage img = null;
try {
img = File(pszImageFile));
TextResult[] results = br.decodeBufferedImage(img, "");

} catch (IOException e) {
TextResult[] results = br.decodeFile(pszImageFile, "");
TextResult[] results = br.decodeFileInMemory(Files.readAllBytes(new File(pszImageFile).toPath()), "");
if (results != null && results.length > 0) {
String pszTemp = null;
iIndex = 0;
for (TextResult result : results) {
pszTemp = String.format(" Barcode %d:", iIndex);
pszTemp = String.format(" Page: %d", result.localizationResult.pageNumber + 1);
if (result.barcodeFormat != 0) {
pszTemp = " Type: " + result.barcodeFormatString;
} else {
pszTemp = " Type: " + result.barcodeFormatString_2;
pszTemp = " Value: " + result.barcodeText;

pszTemp = String.format(" Region points: {(%d,%d),(%d,%d),(%d,%d),(%d,%d)}",
result.localizationResult.resultPoints[0].x, result.localizationResult.resultPoints[0].y,
result.localizationResult.resultPoints[1].x, result.localizationResult.resultPoints[1].y,
result.localizationResult.resultPoints[2].x, result.localizationResult.resultPoints[2].y,
result.localizationResult.resultPoints[3].x, result.localizationResult.resultPoints[3].y);

ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);

for (int i = 1; i <= 1000; i++)
executor.execute(new Runnable(){

public void run() {
App test = new App();
try {
} catch (InterruptedException e) {

How to Build and Run Java Barcode and QR Code Reader

mvn clean install assembly:assembly
java -cp target/test-1.0-SNAPSHOT-jar-with-dependencies.jar com.dynamsoft.App images/AllSupportedBarcodeTypes.png

How to Deploy and Run Java Application Using Docker

  1. Create a Dockerfile:
FROM openjdk:11-stretch
COPY images/AllSupportedBarcodeTypes.png AllSupportedBarcodeTypes.png
COPY target/test-1.0-SNAPSHOT-jar-with-dependencies.jar test-1.0-SNAPSHOT-jar-with-dependencies.jar
CMD java -cp test-1.0-SNAPSHOT-jar-with-dependencies.jar com.dynamsoft.App AllSupportedBarcodeTypes.png
docker rmi dynamsoft/barcode-reader -f
docker build -t dynamsoft/barcode-reader -f Dockerfile .
docker run -it dynamsoft/barcode-reader

Source Code




Manager of Dynamsoft Open Source Projects | Tech Lover

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The 5 things that surprised our newest Software Engineer.

Common Errors in Running IPFS

ACID(SQL) vs BASE(No-SQL) properties

ACID vs BASE properties (SQL vs NoSQL)

Non-Tech Skills You Can Learn from Coding

The objects world in Python

Learning UniRx: Quick tips to get you up to speed

Creating a Flutter Plugin | Dialog Box

A Database or a Search Engine?

Emacs window with the Rebol indexer’s code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Xiao Ling

Xiao Ling

Manager of Dynamsoft Open Source Projects | Tech Lover

More from Medium

How to Compile and Run JUnit Test Class from Command Line

How to Convert CSV Files to XML Files using Java


Parameterized Tests Using JSON File As Input Source