Home
Analytics
BIRT Plugins not getting resolved.
harbir
Hi All,
I am trying to write a simple java BIRT report using BIRT Plugins in eclispe, When I try to import the Class(that is in the plug-in)at the top of the program, it is not getting resolved.
I know how to configure the path for jar files but want to know how to configure the path for the plug-ins, so that they can be resolved by the program.
When I try to configure the path by going to to Java build Path->Libraries>Add Library>Plugin-dependencies, the "Resolved classpath" is all blank.
I also want to know that if the BIRT plugins are depending on some jars or other plug-ins what will those be? and how can I fix that?
Any sort of help will be appreciated.
Reagards
Harbir
Find more posts tagged with
Comments
Happy
What type of plugin is it? Does it extend the functionality of BIRT (like adding new functions to the expression builder), or is it a java event handler.
How are you executing the report? Using the built-in BIRT viewer? or through a standalone application or another method entirely.
I find the easiest way to test the plugin is to export it using eclipse into a plugin .jar file, drop the .jar into the eclipse/plugins directory and re-start eclipse using the -clean option.
If testing in the BIRT-viewer, I drop the jar file into the WEB-INF/platform/plugins directory and it works like a charm (assuming the plugin activators are all set correctly).
If it is a Java Event Handler, it should work automatically from the .class files in the Eclipse development environment, but will need to be exported into the scriptlib directory for the BIRT Viewer application.
Basically, what are you trying to do?
harbir
Hi Happy,<br />
<br />
Thanx for the reply.<br />
<br />
Basically the following is my code.<br />
I am trying to write a java class that will generate a .pdf report, just wanted to try BIRT using a java program.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
import java.util.logging.Level;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.*;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.PDFRenderOption;
public class ExecuteReport {
public static void main(String arge[]) {
try {
executeReport();
} catch (Exception e) {
}
}
static void executeReport() {
IReportEngine engine = null;
EngineConfig config = null;
try {
config = new EngineConfig();
config.setEngineHome("D:birtruntimebirt-runtime-2_5_0ReportEngine");
config.setLogConfig("D:birtlog", Level.FINE);
Platform.startup(config); // If using RE API in Eclipse/RCP
// application this is not needed.
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
engine.changeLogLevel(Level.WARNING);
IReportRunnable design = engine.openReportDesign("D:birtdesignssample.rptdesign");
IRunAndRenderTask task=engine.createRunAndRenderTask(design);
task.setParameterValue("oldParm",(new Integer(10101)));
task.validateParameters();
PDFRenderOption options= new PDFRenderOption();
options.setOutputFileName("test.pdf");
options.setOutputFormat("pdf");
task.setRenderOption(options);
task.run();
task.close();
engine.destroy();
} catch (Exception e) {
e.printStackTrace();
}
try
{
engine.destroy();
Platform.shutdown();
}
catch ( Exception e1 )
{
// Ignore
}
}
}
</pre>
thanx
Happy
okay, so you have a java program, and want to extend it to be able to accept BIRT plugins (Java Event Handlers and the like) in the classpath?<br />
<br />
Try adding these lines to the java program:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
String JARS_PATH = "<<PATH TO PLUGIN JAR FILES>>";
ec.setProperty(EngineConstants.WORKSPACE_CLASSPATH_KEY, JARS_PATH);
</pre>
There are two other EngineConstants you can use, I can't remember their names off the top of my head.