I am using JasperReport
for generation reports in Java Web Application.
I have a following line to get report file.
JasperReport report = (J
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