Barcode for Java > Generate Barcode in Java

How to Generate Barcodes in Java

How to Create Linear and 2D Barcode Images in Java Using Free Barcode Generator Demo
  • A very popular Java barcode generator SDK for linear & two-dimensional barcodes
  • Compatible with almost all operating systems, like Windows 7, Windows XP, etc
  • Simply generate a variety of high quality linear and 2D barcodes in Java class application
  • Allow users to set rich parameters of the barcodes easily according to example guide
  • Support barcode image rotation of four degrees: 0, 90, 180, 270 degrees
  • Easy to reset the image size through the setting of image width & height with user-friendly interface
  • Support creating great quality barcode images in iReport
  • Offer four barcode image output formats (BMP, PNG, GIF and JPEG)
Download KA.Barcode for Java
Permanent Trial
This trial version of Barcode Generator for Java can be used permanently free of charge.
Restrictions of Trial
This free trial version of Barcode Generator for Java cannot be used for any commercial application because a "KA.Barcode" watermark is included in generated barcode images randomly. Please purchase the applicable license for business applications.
How to Generate Barcode Image in Java Class
  1. Barcode generation method tutorial is provided. Firstly, open IntelliJIDEA and create a new project. Here take a new project called "KeepAutomationTutorial" as an example.
  2. Under "Project" pull-down menu, select "KeepAutomationTutorial (C:\Projects\KeepAutomationTutorial" and right click it. Then click "New" - "Directory".
  3. The "New Directory" window opens and input "lib" in the text box of "Enter new directory name". Then click "OK" button. Now copy "com.keepautomation.barcode.jar" in the folder called "lib" (C:\Projects\KeepAutomationTutorial/lib) and then click "Settings (Ctrl+Alt+S)" button in the project.
  4. Click "Modules" in the pop-up window called "Settings". Now a window called "Modules" pops up. Click "Libraries (Classpath)" - "Add Jar/Directory..." and a window called "Select Path" opens. Find and select the project "com.keepautomation.barcode.jar" and then click "OK". In the "Modules" pop-up window, click "Apply" - "OK". And in the "Settings" pop-up window, click "Close".
  5. Under "Project" pull-down menu, right click "src" - "New" - "Class". Now a window called "New Class" shows up. Input "Tutorial" and click "OK".
  6. Input the following Java code in the text box under "Tutorial java"(take Code 128 as an example).
  7. After that, right click "Tutorial" under "src" in "Project" pull-down menu. Then select [Run "Tutorial.main()" Control+Shift+F10] and the "Compile Progress" window opens.
  8. Now double click the "tutorial.jpg" item and you can see the created barcode through this file path: c://code128.gif.
Sample code
     public static void main(String[] args)
{
BarCode barcode = new BarCode();
barcode.setCodeToEncode("123456789");
barcode.setSymbology(IBarCode.CODE128);
barcode.setX(2);
barcode.setY(50);
barcode.setRightMargin(0);
barcode.setLeftMargin(0);
barcode.setTopMargin(0);
barcode.setBottomMargin(0);
barcode.setChecksumEnabled(false);
barcode.setFnc1(IBarCode.FNC1_NONE);
try
{
barcode.draw("c://code128.gif");
}
catch (Exception e) {
e.printStackTrace();
}
}
}
How to Generate Barcodes in iReport
For more detailed information about how to generate barcodes in iReport through JRRenderable Implementation and how to generate barcodes in iReport through Servlet Web Application, please refer to "User Manual" in the KA.Barcode for Java free trial package.
Download Free TrialBarcode in Java ClassBarcode in iReportData Matrix for JavaPDF417 for JavaQR Code for JavamoreCodabar for JavaCode 39 for JavaCode 128 for JavaEAN-8 for JavaEAN-13 for JavaEAN 128 for JavaIntelligent Mail for JavaInterleaved 2 of 5 for JavaISBN for JavaITF-14 for JavaRM4SCC for JavaUPC-A for JavaUPC-E for Javamore
KeepAutomation provides complete barcode automation solutions for Business Application, Enterprise Developement Project, and mobile applications. We recommend the customers use high quality .net image viewer sdk, c# image viewer, vb.net image viewer, C# PDF document viewer, VB.NET PDF document viewer, C# Word document viewer, VB.NET Word document viewer, C# Tiff image viewer, VB.NET Tiff image viewer from RasterEdge.com.