I am using JasperReport
for generation reports in Java Web Application.
I have a following line to get report file.
JasperReport report = (J
The Path you give should be servlet path. Normally, servlets paths have forward slash /
.
Please try this /rpts/report1.jasper"
.
Java language (and others) needs \\
(double backslash) in String
s in order to read a single \
. Your first way should change to
JasperReport report = (JasperReport) JRLoader.loadObject(getServletConfig()
.getServletContext().getRealPath("\\rpts\\report1.jasper"))
Still, it would be better to check paths using /
or even better using File#separator as shown here: File.separator vs Slash in Paths