All code samples are located in the "samples" sub-folder of the Barcode Xpress for Java install directory. They are located in the Accusoft/BarcodeXpressJava13-64/samples folder. It also contains the ReadMe.txt file with detailed instructions on how to build and run the samples.
Barcode Xpress for Java has the following sample to get you started:
Name | Description |
ReadBarcodes | Recognizes the text in an image(s) and prints results to the console. |
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.
Copy Code
|
|
---|---|
cd Accusoft/BarcodeXpressJava13-64/samples/ReadBarcodes |
Linux |
Copy Code
|
---|---|
javac -cp ".:src/main/java:../../bin/barcodexpressjava-13.1.jar" src/main/java/ReadBarcodes.java
|
Windows |
Copy Code
|
---|---|
javac -cp ".;src/main/java;../../bin/barcodexpressjava-13.1.jar" src/main/java/ReadBarcodes.java
|
Linux |
Copy Code
|
---|---|
java -cp ".:src/main/java:../../bin/barcodexpressjava-13.1.jar" ReadBarcodes path/to/your/image.bmp
|
Windows |
Copy Code
|
---|---|
java -cp ".;src/main/java;../../bin/barcodexpressjava-13.1.jar" ReadBarcodes path/to/your/image.bmp
|
Copy Code
|
|
---|---|
cd Accusoft/BarcodeXpressJava13-64/samples/ReadBarcodes |
Copy Code
|
|
---|---|
mvn clean package dependency:copy-dependencies |
Linux |
Copy Code
|
---|---|
java -cp "target/ReadBarcodes-1.0.jar:target/dependency/barcodexpressjava-13.1.jar" ReadBarcodes path/to/your/image.bmp
|
Windows |
Copy Code
|
---|---|
java -cp "target/ReadBarcodes-1.0.jar;target/dependency/barcodexpressjava-13.1.jar" ReadBarcodes path/to/your/image.bmp
|
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.
Copy Code
|
|
---|---|
ReadBarcodes [options] <image1> [<image2> ... <imageN>] |
-t, --type <type> | (optional = true, default = '1d') Barcode types to scan <type>: '1d' - all 1D | '2d' - all 2D | 'all' - all 1D + 2D |
-h, --help | (optional = true) Print this help message |
ReadBarcodes ../images/Barcode-All-Supported-Types.bmp ../images/Barcode-Multiple-Common.bmp
ReadBarcodes -t 2d ../images/Barcode-All-Supported-Types.bmp
ReadBarcodes --type all ../images/Barcode-*