1

i have a jasperreport with some subreports. I want to store the .jasper files inside the classpath.

Actually my reports are in com/myapp/reports.

I can successufly load the main report with this path:

    private static String D1_PACKAGE = "/com/myapp/report/d1.jasper";
...
    InputStream reportD1 = ReportProvider.class.getResourceAsStream(D1_PACKAGE);
    bytes = JasperRunManager.runReportToPdf(reportD1, params, new JREmptyDataSource());

But the problem is when it looks for subreports. They are in the folder but i tried to change the param SUBREPORT_DIR with one of these path but no one works:

./
/com/myapp/report
com/myapp/report
Tobia
  • 9,165
  • 28
  • 114
  • 219
  • I found this: http://stackoverflow.com/questions/4825726/how-to-load-subreport-resources-with-jasper I should have passed subreports as mainreport params – Tobia May 18 '12 at 13:42

1 Answers1

0

I should load the subreports with class.getResourceAsStream than pass it as parameter to the main report.

Tobia
  • 9,165
  • 28
  • 114
  • 219