For Creating Jasper Report u need to import these packages
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager;
public boolean compileReport()
{
try {
JasperCompileManager.compileReportToFile("path of fileName.jrxml");
}
catch (Exception e) {
System.out.println("compile exception " + fileName + ", " + e);
return false;
}
return true;
}
public JasperPrint fillReport()
{
try {
JasperPrint jasperPrint = JasperFillManager.fillReport("fileName.jasper", <parameters if u use any in Jasper Report Design else give null>, new JRFieldLevelAuditSource(data));
return jasperPrint;
} catch (JRException e) {
}
return null;
}
public void print(JasperPrint jasperPrint) {
try {
JasperPrintManager.printReport(jasperPrint, true);
} catch (JRException e)
{
e.printStackTrace();
}
}