I have installed the Jaspersoft Studio plugin from marketPlace. I created a java project and converted it to Maven to import the Jasper report jars. Afterwards I created a Blank_A4.jrxml
file. Therefore, i added some java class from this tutorial
https://www.tutorialspoint.com/jasper_reports/jasper_filling_reports.htm
as in the screenshot below.
The problem is when run the .jrxml file, there is nor .jasper file is being gernerated. Does anyone know what the problem is?
I have changed the path ofsourceFileName
in this class:
package com.tutorialspoint;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class JasperReportFill {
@SuppressWarnings("unchecked")
public static void main(String[] args) {
String sourceFileName =
"C://Users/alex.tree/Documents/iReport Designer workspace/Blank_A4.jasper";
DataBeanList DataBeanList = new DataBeanList();
ArrayList<DataBean> dataList = DataBeanList.getDataBeanList();
JRBeanCollectionDataSource beanColDataSource =
new JRBeanCollectionDataSource(dataList);
Map parameters = new HashMap();
/**
* Passing ReportTitle and Author as parameters
*/
parameters.put("ReportTitle", "List of Contacts");
parameters.put("Author", "Prepared By Manisha");
try {
JasperFillManager.fillReportToFile(
sourceFileName, parameters, beanColDataSource);
} catch (JRException e) {
e.printStackTrace();
}
}
}