<p>Hello,</p>
<p> </p>
<p>I have a problem generating a report with the report engine in the eclipse environment from the BIRT download page (<a data-ipb='nomediaparse' href='
http://download.eclipse.org/birt/downloads/'>http://download.eclipse.org/birt/downloads/</a>). </p>
<p>I'm a little bit confused about it because the code works fine in my own environment and I have no idea why. The BIRT plugin seems to have the same version and every step I made is the same.</p>
<p> </p>
<p>This is my code:</p>
<pre class="_prettyXprint">
public class RunReport {
static void executeReport() throws EngineException{
EngineConfig config = null;
IReportEngine engine = null;
try{
//Create config
config = new EngineConfig();
config.setLogConfig("C:/test/book_report", Level.FINEST);
config.setEngineHome("C:/test/birt-runtime-4_4_0/ReportEngine");
//Create ReportEngine
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
}
catch(Exception ex)
{
ex.printStackTrace();
}
//Open rptdesign
String designName = "C:/datainput/eclipse/workspace/BIRT Reporting/GanttChart.rptdesign";
IReportRunnable runnable = null;
try
{
runnable = engine.openReportDesign(designName);
}
catch(EngineException e)
{
System.err.println ("Design"+ designName + " not found!");
engine.destroy();
System.exit(-1);
}
//Create RunAndRender task
IRunAndRenderTask task = engine.createRunAndRenderTask(runnable);
//Create RenderOptions
HTMLRenderOption options = new HTMLRenderOption();
options.setImageHandler(new HTMLCompleteImageHandler());
options.setOutputFormat( "html" );
options.setOutputFileName("C:/test/book_report/test.html");
options.setImageDirectory("C:/test/book_report/image");
options.setEmbeddable(false);
//Apply options
task.setRenderOption(options);
//Run task
try{
task.run();
task.close();
Platform.shutdown();
}
catch(EngineException e1)
{
System.err.println(e1.toString());
}
}
public static void main(String[] args)
{
try{
executeReport();
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
</pre>
<p>This creates the following exception:</p>
<p>Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IExtensionRegistry<br>
at org.eclipse.birt.core.framework.jar.ServicePlatform.<init>(ServicePlatform.java:46)<br>
at org.eclipse.birt.core.framework.jar.ServiceLauncher.startup(ServiceLauncher.java:46)<br>
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:75)<br>
at reportExec.RunReport.executeReport(RunReport.java:34)<br>
at reportExec.RunReport.main(RunReport.java:92)</p>
<p> </p>
<p> </p>
<p>While debugging the error occures at Platform.startup(config);</p>
<p> </p>
<p>I'm pretty new to BIRT and even Java itself and I'm having a hard time learning it so correct me if I'm doing anything wrong.</p>
<p>Any ideas?</p>