Hi, below is an alternative solution based on Free Spire.Barcode for Java. Hope it helps.
import com.spire.barcode.BarCodeGenerator;
import com.spire.barcode.BarCodeType;
import com.spire.barcode.BarcodeSettings;
import com.spire.barcode.QRCodeECL;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class QRCode {
public static void main(String[] args) throws IOException {
//create an instance of BarcodeSettings
BarcodeSettings settings = new BarcodeSettings();
//set barcode type
settings.setType(BarCodeType.QR_CODE);
//set barcode data
settings.setData("Č,Š Ž (ISO-8859-2)");
//set dispaly text
settings.setData2D("Č,Š Ž (ISO-8859-2)");
//show text on bottom
settings.setShowTextOnBottom(true);
//set the border invisible
settings.hasBorder(false);
//set width of the barcode module
settings.setX(2);
//set the error correction level
settings.setQRCodeECL(QRCodeECL.M);
//create BarCodeGenerator object based on settings
BarCodeGenerator barCodeGenerator = new BarCodeGenerator(settings);
//generate image data and store in BufferedImage instance
BufferedImage bufferedImage = barCodeGenerator.generateImage();
//save to image
ImageIO.write(bufferedImage,"png",new File("QR_CODE.png"));
System.out.println("Complete!");
}
}