Java Barcode Generator, .NET Barcode Generator for C#, ASP.NET, VB.NET
HOME PURCHASE SITEMAP COMPANY

Home > Products > Java Barcode > Java Barcode Generator


Java Barcode Generator


Generating 1d & 2d barcode images with BarcodeLib Barcode for Java library. This page is a demonstration and guide of how our Java Barcode library can be used.

For more information, please visit the Java Barcode Package page.



The following code illustrates how to generate a 1d (linear) barcode in a Java class

	1            Linear linear = new Linear(); 
	2            linear.setData("123456789"); 
	3            linear.setType(Linear.CODE128); 
	4            linear.renderBarcode("c:/barcode.gif"); 
	
	
	

  • Create a Linear barcode object (line 1)
  • set Linear object barcode properties (line 2 - 3)
  • save into gif file (line 4)



There are two ways to create barcode images in your Java web applications.

  1. This is the simplest way to stream barcode image using our provided barcode servlet classes.

    And it will not save barcode images in your server side.

    • Under demo package, copy barcode folder to your java servlet container like tomcat.

    • To test your installation, goto http://YourDomain:Port/barcode/linear?Data=123456789&Type=CODE128

    • To create barcode image in your JSP or html page, you can pass the url to IMG tag src value. For example, <img src="http://YourDomain:Port/barcode/linear?Data=123456789&Type=CODE128" />

  2. The second method is similar with the way to generate barcode in Java applications.

    • Create a barcode image in server side

      				1            Linear linear = new Linear(); 
      				2            linear.setData("123456789"); 
      				3            linear.setType(Linear.CODE128); 
      				4            linear.renderBarcode("C:/Tools/Tomcat 5.5/webapps/YourWebApp/bimages/barcode.gif"); 
      				
      				
      				

    • In your JSP page, you can using IMG tag to display generated image, like <img src="http://YourDomain:Port/YourWebApp/bimages/barcode.gif" />

Barcode Types/Symbologies


 





   Copyright 2009 BarcodeLib.com. Provides High Quality Java Barcode Generator, Barcode Generator Java, Java Bar Code Generator. All rights reserved.