我的项目具有以下架构:
我的模板是“report1.jrxml”,然后当我执行这段代码时:
TableModel model = (TableModel) masterTable.getModel();
JRTableModelDataSource data = new JRTableModelDataSource(model);
String reportSource ="report1.jrxml";
try {
JasperReport jr = JasperCompileManager.compileReport(reportSource);
JasperPrint jp = JasperFillManager.fillReport(jr, null,data);
} catch (JRException ex)
{
Logger.getLogger(master.class.getName()).log(Level.SEVERE, null, ex);
}
我收到这个错误(我很抱歉法语,但很容易理解:p):
Grave: null
net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: report1.jrxml (Le fichier spécifié est introuvable)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:176)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:171)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:448)
at testjasper.master.jButton1ActionPerformed(master.java:319)
at testjasper.master.access$900(master.java:25)
at testjasper.master$FormListener.actionPerformed(master.java:259)
Netbeans 说找不到该文件,但正如您在屏幕截图中看到的那样,它存在吗?我怎么解决这个问题” ?相反,有什么问题?致以我的问候。:p