java - BIRT csv emitter plugin error - -
i trying csv study using this well-known plugin , illustration documentation, throws exception. wonder why, because copied of code doc.
my code is:
import java.io.fileinputstream; import java.io.filenotfoundexception; import java.util.logging.level; import org.eclipse.birt.core.exception.birtexception; import org.eclipse.birt.core.framework.platform; import org.eclipse.birt.report.engine.api.engineconfig; import org.eclipse.birt.report.engine.emitter.csv.csvrenderoption; 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; public class runreport { static void runreport() throws filenotfoundexception, birtexception { string resourcepath = "c:\\users\\hpsa\\workspace\\my reports\\"; fileinputstream fs = new fileinputstream(resourcepath + "new_report_1.rptdesign"); ireportengine engine = null; engineconfig config = new engineconfig(); config.setenginehome("c:\\birtre\\birt-runtime-4_3_2\\"); config.setlogconfig("c:\\birtre\\", level.fine); config.setresourcepath(resourcepath); platform.startup(config); ireportenginefactory mill = (ireportenginefactory) platform.createfactoryobject(ireportenginefactory.extension_report_engine_factory); engine = factory.createreportengine(config); engine.changeloglevel(level.fine); ireportrunnable design = engine.openreportdesign(fs); irunandrendertask task = engine.createrunandrendertask(design); csvrenderoption csvoption = new csvrenderoption(); string format = csvrenderoption.output_format_csv; csvoption.setoutputformat(format); csvoption.setoutputfilename("newbirtcsv.csv"); csvoption.setshowdatatypeinsecondrow(true); csvoption.setexporttablebyname("secondtable"); csvoption.setdelimiter("\t"); csvoption.setreplacedelimiterinsidetextwith("-"); task.setrenderoption(csvoption); task.setemitterid("org.eclipse.birt.report.engine.emitter.csv"); task.run(); task.close(); platform.shutdown(); system.out.println("report generated sucessfully!!"); } public static void main(string[] args) { seek { runreport(); } grab (exception e) { e.printstacktrace(); } } }
i getting exception:
exception in thread "main" java.lang.noclassdeffounderror: org/eclipse/core/runtime/coreexception @ org.eclipse.birt.core.framework.platform.createplatformlauncher(platform.java:115) @ org.eclipse.birt.core.framework.platform.startup(platform.java:74) @ com.demshin.birttest.runreport.runreport(runreport.java:26) @ com.demshin.birttest.runreport.main(runreport.java:55) caused by: java.lang.classnotfoundexception: org.eclipse.core.runtime.coreexception @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) ... 4 more
i found bundle org.eclipse.core.runtime , registered in build path, getting same exception. indeed, there no coreexception.class in org.eclipse.core.runtime package. doing wrong?
setting engine home deprecated , of time prevent platform start, such in case. remove line:
config.setenginehome("c:\\birtre\\birt-runtime-4_3_2\\");
you have ensure birt runtime 4.3.2 in classpath of context. furthermore recommend seek generate native format such pdf first, , seek csv format.
java birt birt-emitter
No comments:
Post a Comment