O'Reilly logo

JasperReports 3.5 for Java Developers by David Heffelfinger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a binary report template

The JRXML files cannot be used directly to generate reports. They need to be compiled into JasperReports' native binary format. Compiled report templates are called jasper files. There are two ways to compile a JRXML file into a jasper file: We can do it either programmatically or through a custom ANT task provided by JasperReports.

Compiling a JRXML template programmatically

A JRXML template can be compiled into a jasper file and saved to disk by calling the compileReportToFile() method on the net.sf.jasperreports.engine.JasperCompileManager class. The three overloaded versions of the JasperCompileManager.compileReportToFile() method are listed below:

  • JasperCompileManager.compileReportToFile(String sourceFileName) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required