-1

I created simple app to generate pdf report using Eclipse BIRT. I loaded jars from ReportEngine folder into project build path. Code looks like this:

EngineConfig config;
try{
    config = new EngineConfig( );
    config.setEngineHome( "C:\\birt-runtime-2_6_2\\birt-runtime-2_6_2\\ReportEngine" );
    config.setLogConfig("c:/temp", Level.FINE);
    ReportEngine engine = new ReportEngine(config);
    engine.changeLogLevel( Level.WARNING );
    String name = "C:\\Users\\Djordje\\EclipseProjects\\ReportingApp\\new_report.rptdesign";
    IReportRunnable report = engine.openReportDesign(new FileInputStream(name  ));
    PDFRenderOption pdf = new PDFRenderOption();
    pdf.setOutputFormat("pdf");
    pdf.setOption(PDFRenderOption.PAGE_OVERFLOW, Integer.valueOf(PDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES));
    pdf.setOption( IRenderOption.HTML_PAGINATION, Boolean.FALSE );
    pdf.setOutputFileName("D:/djole" +".pdf");
    IRunAndRenderTask task  = engine.createRunAndRenderTask(report);
    task.setRenderOption(pdf);
    task.run();
}catch ( Exception e1 ){
}

And here is the error I get when I run the project:

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/birt/report/engine/api/IRenderOption
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.privateGetMethodRecursive(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.eclipse.birt.report.engine.api.IRenderOption
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

Could someone tell me what am I doing wrong, and is there any tutorial for developing code for running report on desktop app?

enter image description here enter image description here enter image description here HERE IS ALL JARS LOADED INTO CLASSPATH enter image description here

djoleasterix
  • 51
  • 1
  • 6
  • Could you add your classpath settings? So you have a different seting vor your runtime the for comoile time? – triplem Jan 19 '17 at 23:03
  • Im not sure I understood you. – djoleasterix Jan 20 '17 at 03:13
  • How do you build the application? Maven, Ant? Eclipse itself? How do you run the application? Tomcat? Jboss? Please show your classpath (contained libraries) for running the app as well as compiling the app, there seems to be different settings for both of those. – triplem Jan 20 '17 at 10:08
  • The application is built in Eclipse, its just a test app with main method that is posted in question. I run application as a simple console app. The classpath is posted in question. – djoleasterix Jan 20 '17 at 14:59
  • Hm, I guess the referenced birt_runtime Jar is just referenced, and you should put this jar into the Runtime Path of the application. – triplem Jan 20 '17 at 20:45
  • And, how I`m supposed to do that. I tried to change runtime classpath by setting %CLASSPATH% enviroment variable and by setting classpath in Edit launch configuration window. Is there any good tutorial on this? Thanks in advance, man! – djoleasterix Jan 20 '17 at 21:02

1 Answers1

0

Solved it by using earlier version of birt_runtime, 4.4.1 to be specific. Thanks to triplem for all the effort.

djoleasterix
  • 51
  • 1
  • 6