I am trying to make a pdf file using java file and also using jasperreport only ,but gets an error.Below is the java code and .jrxml code.
When i first try compileReportToFile it execute successfully then i commented the JasperCompileManager line and added fillReportToFile line ,then run the file which result into error.
Below is the java and .jrxml code.
Regjes.java
Regjes.java
HellW.jrxml
When i first try compileReportToFile it execute successfully then i commented the JasperCompileManager line and added fillReportToFile line ,then run the file which result into error.
Below is the java and .jrxml code.
Regjes.java
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
public class FirstReportCompile
{
public static void main(String[] args)
{
try
{
System.out.println("Compiling report...");
JasperCompileManager.compileReportToFile("report/template/HelloW.jrxml");
System.out.println("Done!");
}
catch (JRException e)
{
e.printStackTrace();
}
}
}
Regjes.java
import java.util.HashMap;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
public class FirstReportFill
{
public static void main(String[] args)
{
try
{
System.out.println("Filling report...");
JasperFillManager.fillReportToFile ("./report/template/HelloReportWorld.jasper",
new HashMap(), new JREmptyDataSource());
System.out.println("Done!");
}
catch (JRException e)
{
e.printStackTrace();
}
}
}
HellW.jrxml
<?xml version="1.0"?>
<!DOCTYPE jasperReport
PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="HelloReportWorld">
<detail>
<band height="20">
<staticText>
<reportElement x="20" y="0" width="200" height="20"/>
<text><![CDATA[If you don’t see this, it didn’t work]]></text>
</staticText>
</band>
</detail>
</jasperReport>
Sapan
24 Mar 2010