ramilash Posted February 19, 2007 Share Posted February 19, 2007 posted Today 04:01 PM Profile for Shalimar Lagcao Email Shalimar Lagcao Send New Private Message Edit/Delete Post Reply With Quote I am new to Jasper reports. I copy a sample code on how to use jasper reports using Netbeans 5.5. Following the procedure and compile the application, and like magic, series of errors appear. Can you help me guys in solving this. Here is the code (very simple and yet have errors): HelloReportWorld.jrxml----Start after this line---- <?xml version="1.0"?><!DOCTYPE jasperReportPUBLIC "-//JasperReports//DTD Report Design//EN""http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="HelloReportWorld"><detail><band height="20"><staticText><reportElement x="180" y="0" width="200" height="20"/><text><![CDATA[Hello World!]]></text></staticText></band></detail></jasperReport> ------- end here --------- Main.java ----Start after this line---- package reportapps; import java.util.HashMap;import net.sf.jasperreports.engine.JREmptyDataSource;import net.sf.jasperreports.engine.JRException;import net.sf.jasperreports.engine.JasperCompileManager;import net.sf.jasperreports.engine.JasperExportManager;import net.sf.jasperreports.engine.JasperFillManager;import net.sf.jasperreports.engine.JasperPrint;import net.sf.jasperreports.engine.JasperReport; /**** @author shalimar*/public class Main { /** Creates a new instance of Main */public Main() {} /*** @param args the command line arguments*/public static void main(String[] args) {JasperReport jasperReport;JasperPrint jasperPrint;try {jasperReport = JasperCompileManager.compileReport( "report/templates/HelloReportWorld.jrxml");jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource());JasperExportManager.exportReportToHtmlFile( jasperPrint, "report/results/simple_report.pdf");} catch (JRException e) {e.printStackTrace();}} } ------END HERE------------ COMPILER ERROR: ----Start after this line---- net.sf.jasperreports.engine.JRException: Error compiling report java source files : /home/shalimar/ReportApps/HelloReportWorld_1171871987558_150188.javaat net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:93)at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:67)at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)at reportapps.Main.main(Main.java:38)Caused by: java.io.IOException: java.io.IOException: javac: not foundat java.lang.UNIXProcess.<init>(UNIXProcess.java:148)at java.lang.ProcessImpl.start(ProcessImpl.java:65)at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)at java.lang.Runtime.exec(Runtime.java:591)at java.lang.Runtime.exec(Runtime.java:464)at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62)... 6 more ------END HERE---------- Can you help me on this? Thanks Shalimar Link to comment Share on other sites More sharing options...
narendrasingh Posted February 19, 2007 Share Posted February 19, 2007 JasperCompileManager.compileReportToFile(context.getRealPath("/reports/WebappReport.jrxml")); i m using this code to comple jrxml file it si running fine i m using tomcat thanksNarendra Singh Link to comment Share on other sites More sharing options...
dgmanu Posted February 19, 2007 Share Posted February 19, 2007 use this Code:JasperCompileManager.compileReportToFile(context.getRealPath("/reports/WebappReport.jrxml"«»),context.getRealPath("/reports/WebappReport.jasper"«»)); then Code:[code]JasperPrint jasperPrint = JasperFillManager.fillReport(context.getRealPath("/reports/WebappReport.jrxml"«»),parameters,con); hope this wil help you Link to comment Share on other sites More sharing options...
teodord Posted February 19, 2007 Share Posted February 19, 2007 Hi, Put the jdt-compile.jar file in the classpath of you application and the problem should go away.You can find this jar file in the /lib directory of our project distribution package. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
Nick Posted February 27, 2007 Share Posted February 27, 2007 Hi ramilash! Could you tell me if your problem was solved? Please, help. I'm with a similar problem here.Thanks in advance,Diego Link to comment Share on other sites More sharing options...
Mourado Posted March 9, 2007 Share Posted March 9, 2007 HiI am doing my first steps with jasper and strange thing occurs .even after adding all jar.files to class path.eclipse can't resolve import net.sf.jasperreports.engine.JREmptyDataSource;import net.sf.jasperreports.engine.JRException;import net.sf.jasperreports.engine.JasperFillManager; I am under mandriva 2007 environment and under windos XP import are resolved :blush: Link to comment Share on other sites More sharing options...
leyla.s Posted March 22, 2007 Share Posted March 22, 2007 just to give other developers a feedback: teodord's hint to put the jdt-compile.jar file in the classpath of the application made Jasper compile my jrmxl file successfully. thank you very much! leyla. Link to comment Share on other sites More sharing options...
mrdata Posted August 12, 2011 Share Posted August 12, 2011 Hi am at lost cause i am try to comple and getting an error that there exist no main i am using netbeans can some one lead me to understand how to comple. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now