Barcode4J is a free and flexible Java library for Barcode generation.
This requires the libraries barcode4j.jar, avalon-framework-4.2.0.jar to be in classpath.
The following example shows generating EAN 13 Barcode.
//Bar code type
DefaultConfiguration child = new DefaultConfiguration(type);
cfg.addChild(child);
//Human readable text position
DefaultConfiguration attr = new DefaultConfiguration("human-readable");
DefaultConfiguration subAttr = new DefaultConfiguration("placement");
subAttr.setValue("bottom");
attr.addChild(subAttr);