Print a QR Code in JasperReports 5.6.1

2019-07-24 18:42发布

问题:

I get the following error when trying to print a QR code in JasperReports

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
                value = com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage(new com.google.zxing.qrcode.QRCodeWriter().encode("((java.lang.String)field_RECSEQ.getValue())",com.google.zxing.BarcodeFormat.QR_CODE,300 ,150 )); //$JR_EXPR_ID=10$

回答1:

I got this working by adding the core.jar and javase.jar to build path.