We are using JasperReports as our reporting tool. Earlier we were using relative paths for
jasper files for filling report and it’s working fine.
Now, we want to create a new jar for all compiled jrxml files. i.e a jar containing all .jasper files for our project.
Is there a way to access those .jasper files within a jar file while filling report. Because in documentation, i always see
fillReport(java.lang.String sourceFileName, java.util.Map params)
where, sourcefile is always a path on filesystem.
My question is, is there a way to access compiled .jasper files present within a jar file
and fill report based on those files ?
EDIT:
Essentially what is required is, i need to access .jasper files from a jar file, and then fill reports using that .jasper file and save the generated reports onto a filesystem.
Most APIs worth using will provide overloaded methods to accept input streams. E.G.
JasperFillManager.fillReport(InputStream, Map)To get in
InputStream, useClass.getResourceAsStream().