My .jrxml file contains 2 text and one param
Following is my java code for jasper report, When i run the code it creates pdf file but it is always empty any help ?
public class TestReport {
public static void runReport(String reportFile) {
try{
Map parameters = new HashMap();
parameters.put("my_var", "Address Report");
JasperDesign jasperDesign = JRXmlLoader.load(reportFile);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jsp = JasperFillManager.fillReport(jasperReport, parameters);
JasperExportManager.exportReportToPdfFile(jsp, "/home/ireports/test1.pdf");
}catch(Exception ex) {
String connectMsg = "Could not create the report " + ex.getMessage() + " " + ex.getLocalizedMessage();
System.out.println(connectMsg);
}
}
public static void main(String args[]){
runReport("/home/ireports/report1.jrxml");
}
}