This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet can't find the specified path

 
malik ge
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having problem calling Jasper report from servlet.

When I run the following program in main method, it works fine.


But when do public void displayReport(), and calls it from a servlet,


I got an Exception that
net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: reports\report.jrxml (The system cannot find the path specified)


Any Idea why I am getting an exception that file not found?
 
endswel shui
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

try to use the request.getRealPath("/")
getServletContext().getRealPath("/");
this.getClass().getClassLoader().getResource("").getPath();
and analyze and reorganize it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic