简体   繁体   中英

exception file not found - net.sf.jasperreports.engine.JRException

I write code for generate report using jasper report in java, I write following code to generate report from the mysql database using resultset.

JRResultSetDataSource resultSetDataSource = new JRResultSetDataSource(resultSet);
System.out.println("Filling report...");
JasperFillManager.fillReportToFile("reports/DbReportDS.jasper", null, resultSetDataSource);
System.out.println("Done!");

when I execute this code it generates the following error

Filling report...
net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: reports\DbReportDS.jasper

try

URL in = this.getClass().getResource("/wifi/tickets/tickets.jasper");
report = (JasperReport) JRLoader.loadObject(in);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM