Java - Sample Design Engine (BIRT)

From Eclipsepedia

Revision as of 13:15, 9 April 2007 by (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

< To: Integration Examples (BIRT)

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


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/;$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"

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

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.