Skip navigation links

Package net.sf.jasperreports.compilers

Contains classes for report compiling and expressions evaluating.

See: Description

Package net.sf.jasperreports.compilers Description

Contains classes for report compiling and expressions evaluating.

Compiling Report Templates

Source report templates, created either by using the API or by parsing JRXML files, are subject to the report compilation process before they are filled with data.

This is necessary to make various consistency validations and to incorporate into these report templates data used to evaluate all report expressions at runtime.

The compilation process transforms JasperDesign objects into JasperReport objects. Both classes are implementations of the same basic JRReport interface. However, JasperReport objects cannot be modified once they are produced, while JasperDesign objects can. This is because some modifications made on the report template would probably require re-validation, or if a report expression is modified, the compiler-associated data stored inside the report template would have to be updated.

JasperDesign objects are produced when parsing JRXML files using the JRXmlLoader or created directly by the parent application if dynamic report templates are required. The GUI tools for editing JasperReports templates also work with this class to make in-memory modifications to the report templates before storing them on disk.

A JasperDesign object must be subject to the report compilation process to produce a JasperReport object.

Central to this process is the JRCompiler interface, which defines two methods, one being the following:

 public JasperReport compileReport(JasperDesign design) throws JRException;
There are several implementations for this compiler interface depending on the language used for the report expressions or the mechanism used for their runtime evaluation.

Expressions Scripting Language

The default language for the report expressions is Java, but report expressions can be written in Groovy, JavaScript or any other scripting language as long as a report compiler implementation that can evaluate them at runtime is available.

JasperReports currently ships report compiler implementations for the Groovy scripting language (, JavaScript (, and the BeanShell scripting library ( The compiler implementation classes are:

Historically, these compiler implementations used to be shipped as separate samples, but now they are part of the core library.

Related Documentation

JasperReports Tutorial
Skip navigation links

© 2001 - 2018 TIBCO Software Inc.