Hello to everyone, <br />
<br />
i have always called Birt reports via php following the examples on the eclipse site. Now i'd like to call a report from a java application. I tried a simple example ( taken from: <a class='bbc_url' href='
http://wiki.eclipse.org/Simple_Execute_(BIRT)_2.1):'>Simple Execute (BIRT) 2.1): - Eclipsepedia</a><br />
<br />
import java.util.HashMap;<br />
import java.util.logging.Level;<br />
<br />
import org.eclipse.birt.core.framework.Platform;<br />
<br />
import org.eclipse.birt.report.engine.api.*;<br />
public class ExecuteReport {<br />
<br />
public static void executeReport() throws EngineException<br />
{<br />
<br />
IReportEngine engine=null;<br />
EngineConfig config = null;<br />
<br />
try{<br />
config = new EngineConfig( ); <br />
config.setBIRTHome("C:eclipsebirt-runtimeReportEngine");<br />
config.setLogConfig("c:/birt/test", Level.FINEST);<br />
Platform.startup( config );<br />
<br />
IReportEngineFactory factory = (IReportEngineFactory) Platform<br />
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );<br />
engine = factory.createReportEngine( config ); <br />
<br />
IReportRunnable design = null;<br />
//Open the report design<br />
design = engine.openReportDesign("c:/eclipse/birt-runtime/chart_listing.rptdesign"); <br />
IRunAndRenderTask task = engine.createRunAndRenderTask(design); <br />
//task.setParameterValue("Top Count", (new Integer(5)));<br />
//task.validateParameters();<br />
<br />
HTMLRenderOption options = new HTMLRenderOption(); <br />
options.setOutputFileName("c:/birt/test.html");<br />
options.setOutputFormat("html");<br />
options.setHtmlRtLFlag(false);<br />
options.setEmbeddable(false);<br />
//options.setImageDirectory("C:testimages");<br />
/*<br />
PDFRenderOption options = new PDFRenderOption();<br />
options.setOutputFileName("c:/birt/test.pdf");<br />
options.setOutputFormat("pdf");<br />
*/<br />
task.setRenderOption(options);<br />
task.run();<br />
task.close();<br />
engine.destroy();<br />
}catch( Exception ex){<br />
ex.printStackTrace();<br />
} <br />
finally<br />
{<br />
Platform.shutdown( );<br />
}<br />
}<br />
<br />
public static void main(String[] args) {<br />
try{<br />
executeReport( );<br />
}<br />
catch ( Exception e ){<br />
e.printStackTrace();<br />
}<br />
} <br />
}<br />
<br />
and i keep getting:<br />
java.lang.NullPointerException<br />
at org.eclipse.birt.report.engine.api.impl.ReportEngine$EngineExtensionManager.<init>(ReportEngine.java:779)<br />
at org.eclipse.birt.report.engine.api.impl.ReportEngine.<init>(ReportEngine.java:104)<br />
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory.createReportEngine(ReportEngineFactory.java:13)<br />
at ExecuteReport.executeReport(ExecuteReport.java:23)<br />
at ExecuteReport.main(ExecuteReport.java:58)<br />
<br />
I have included in the path all the .jar files i found in the lib directory and all the .jar files i found in the plugins directory.<br />
I'm not very good in java but it doesn't look like a class is missing.<br />
<br />
Can anyone help me?<br />
<br />
Thank you<br />
<br />
rali