Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Java - Sample Design Engine (BIRT)

< To: Integration Examples (BIRT)

Moved from the old examples area BIRT Design Engine API

This example uses Apache Derby sample database


Here is an example of the derby_sample.rptdesign that was created using the Apache Derby sample database as the backend. The design was created using the report designer in Eclipse 3.2.

The below java program creates a similar report design using the DE API to show how one can use the DE api to make changes dynamically to the report outside of eclipse.

See the source code here DerbySampleDE.java

Steps:

1. Download the Birt runtime 2.1.1 download
2. To compile the program, set the classpath to include all the jars in the ReportEngine/lib directory that you get as part of the BIRT runtime download.

Set classpath to include all the jars in the $BIRT_HOME/ReportEngine/lib directory.
For example, if you downloaded the birt runtime and extracted it at C:/BIRT/birt-runtime-2_1_1:

export BIRT_HOME="C:/BIRT/birt-runtime-2_1_1"
export BIRTCLASSPATH="$BIRT_HOME/ReportEngine/lib/itext-1.3.jar;$BIRT_HOME/ReportEngine/lib/itextAsian.jar;$BIRT_HOME/ReportEngine/lib/commons-cli-1.0.jar;$BIRT_HOME/ReportEngine/lib/commons-codec-1.3.jar;$BIRT_HOME/ReportEngine/lib/com.ibm.icu_3.4.4.1.jar;$BIRT_HOME/ReportEngine/lib/coreapi.jar;$BIRT_HOME/ReportEngine/lib/dteapi.jar;$BIRT_HOME/ReportEngine/lib/engineapi.jar;$BIRT_HOME/ReportEngine/lib/scriptapi.jar;$BIRT_HOME/ReportEngine/lib/js.jar;$BIRT_HOME/ReportEngine/lib/modelapi.jar;$BIRT_HOME/ReportEngine/flute.jar;$BIRT_HOME/ReportEngine/lib/sac.jar;$BIRT_HOME/ReportEngine/lib/chartengineapi.jar;$BIRT_HOME/ReportEngine/lib/org.eclipse.emf.ecore_2.2.0.v200606051102.jar;$BIRT_HOME/ReportEngine/lib/org.eclipse.emf.ecore.xmi_2.2.0.v200606051102.jar;$BIRT_HOME/ReportEngine/lib/org.eclipse.emf.common_2.2.0.v200606051102.jar"
export CLASSPATH=".;$BIRTCLASSPATH"

Once you have set the classpath, you can compile it using javac compiler.
javac DerbySampleDE.java

3. To run the program, you need to specify the BIRT_HOME as a property
Run DerbySampleDE to generate the report design
java -DBIRT_HOME=$BIRT_HOME/ReportEngine DerbySampleDE

4. Output is DerbySampleDE.rptdesign  This design is developed using the DE API.

Back to the top