I am trying to write a sample report:
Here is my code:
public static void main(
String[] args) {
// TODO Auto-generated method stub
JasperReport jasperReport;
JasperPrint jasperPrint;
System.setProperty("jasper.reports.compile.keep.java.file", "true" );
try
{
jasperReport = JasperCompileManager.compileReport( "helloWorld/reportdemo.jrxml");
// jasperReport = JasperCompileManager.compileReport( "C:/Documents and Settings/lilyj2/workspace/HelloWorld/helloWorld/reportdemo.jrxml");
jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(jasperPrint, "reports/simple_report.pdf");
}
catch (JRException e)
{
e.printStackTrace();
}
}
}
HERE is my JRXML:
<?xml version="1.0"?>
<!DOCTYPE jasperReport
PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="Simple_Report">
<detail>
<band height="20">
<staticText>
<reportElement x="180" y="0" width="200" height="20"/>
<text><![CDATA[Hello World!]]></text>
</staticText>
</band>
</detail>
</jasperReport>
HERE is my ERROR:
net.sf.jasperreports.engine.JRException: Error compiling report
java source files : C:\Documents and Settings\lilyj2\workspace\HelloWorld\Simple_Report_1169046274468_913994.java
at 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 helloWorld.JasperFirst.main(JasperFirst.java:25)
Caused by: java.io.IOException: CreateProcess: javac -classpath "C:\Documents and Settings\lilyj2\workspace\HelloWorld;C:\Program Files\JasperReports\Jakarta\commons-digester-1.8.zip;C:\Program Files\JasperReports\jasperreports-1.3.0.jar;C:\Program Files\JasperReports\jasperreports-1.3.0-project.zip;C:\Program Files\JasperReports\jasperreports-1.3.0-javaflow.jar;C:\Program Files\JasperReports\commons-beanutils.jar;C:\Program Files\JasperReports\commons-beanutils-bean-collections.jar;C:\Program Files\JasperReports\commons-beanutils-core.jar;C:\Program Files\JasperReports\commons-logging-1.1.jar;C:\Program Files\JasperReports\Jakarta\commons-collections-3.2.jar;C:\Program Files\JasperReports\Jakarta\commons-digester-1.8.jar;C:\Program Files\JasperReports\Jakarta\itext-1.4.8.zip" "C:\Documents and Settings\lilyj2\workspace\HelloWorld\Simple_Report_1169046274468_913994.java" error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62)
... 6 more
Thanks in advance