I have done project, my problem is put path or classpath of report that I make it. Sorry I am newbie around making a report. The report that I made with iReport has .jrxml extension, but NetBeans not read files .jrxml?
So I compiled this report to a .jasper and save this report to folder src/reports/MenuProduk.jasper.
My problem is why my Java NetBeans cann't read my report?
My code is:
public ReportViewProduk(String vName) {
initComponents();
dao = new ProdukDao();
produkList= dao.getListData();
try {
Map m;
m = new HashMap();
m.put("Print By", "Sanjaya");
jasperPrint=JasperFillManager.fillReport(getClass().getResourceAsStream("/reports/produkReport.jasper"),
m,new JRBeanCollectionDataSource(produkList));
if(PanelReport.getComponentCount()>0){
PanelReport.removeAll();
}
PanelReport.add(new JRViewer(jasperPrint));
PanelReport.updateUI();
} catch (JRException ex) {
System.out.println("Error : " + ex.getMessage());
Logger.getLogger(ReportViewProduk.class.getName()).log(Level.SEVERE, null, ex);
}
}