This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes FileNotFoundException when running application using jasperreports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "FileNotFoundException when running application using jasperreports" Watch "FileNotFoundException when running application using jasperreports" New topic
Author

FileNotFoundException when running application using jasperreports

Joshua Ebarvia
Ranch Hand

Joined: Sep 25, 2007
Posts: 70
Hello! I have compiled my java application done using Netbeans and it generated a .jar file.

My application is able to load the jasper reports if i compile and run it in my local machine.

However, if i distribute my application to another machine, the jasper report cannot be loaded and returns jrexceptions: java.io.filenotfoundexception: c:/reports/reportInvestment.jasper

my code is this using the



Please help


Lovin' java
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
JasperManager method fillReport is overridden and can take as the first parameter, a String Object (Which you are using), an InputStream or a JasperReport object.

Using the String method requires the report template to be on the file system. When you do your deployment, you need to create report directory on the C drive of the target machine and put a copy of reportInvestment.jasper there.

A better way to do this to make deployments easier is to include /reports/reportInvestment.jasper in your Jar file and change your code to :



I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Joshua Ebarvia
Ranch Hand

Joined: Sep 25, 2007
Posts: 70
I have followed your instructions and it WORKS.

Thanks Carl.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FileNotFoundException when running application using jasperreports
 
Similar Threads
Jasper Compile issue rergarding crosstab
jrexception: report.jasper can't be found please help
Exporting .jasper files with NetBeans
Jasper Reports
Generating a Jasper report