【发布时间】:2019-03-22 02:46:52
【问题描述】:
在我的 Spring boot webapp 中,我尝试实现一些后端功能以使用 JasperReports 生成 PDF 文件。
我的文件结构如下:
应用程序在运行时可以毫无问题地查看application-*.properties 或static 文件夹中的任何文件。
我已经编写了一段代码来生成报告并显示在JasperViewer:
JasperPrint print = null;
try {
JasperCompileManager.compileReportToFile("invoices/invoice.jrxml");
print = JasperFillManager.fillReport("invoices/invoice.jasper", new HashMap<>());
JasperViewer jasperViewer = new JasperViewer(print);
jasperViewer.setVisible(true);
} catch (JRException e) {
e.printStackTrace();
}
但是当我尝试运行应用程序时,我得到的只是:
net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: invoices/invoice.jrxml (No such file or directory)
【问题讨论】:
标签: java jasper-reports filenotfoundexception