• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

jrexception: report.jasper can't be found please help

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

code:

Class.forName("com.mysql.jdbc.Driver");

//set generic location
String jasperLocation = String.valueOf(getClass().getResource("/report/reportInvestment.jasper")).substring(5);

javax.swing.JOptionPane.showMessageDialog(null, jasperLocation);
net.sf.jasperreports.engine.JasperPrint jasperPrint = net.sf.jasperreports.engine.JasperFillManager.fillReport(jasperLocation, hashMap, connection);
net.sf.jasperreports.engine.

}
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it a typo?


c:/reports/reportInvestment.jasper (reports with s)



"/report/reportInvestment.jasper" (report without s)

 
Joshua Ebarvia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to correct that as well. It ain't working yet.

I have copied the jar file and the lib folder to another machine.

On clicking the jar file, the application starts, however, when clicking the button to show report, an error occurred. The error is jrexception: java.io.filenotfoundexception : report.jasper can't be found.

On my local machine. it all works fine, no errors.

I think there is a problem on the fillReport() because it points to the local class, but when compiled it is all packed up in a single jar file.

Please help
 
it's a teeny, tiny, wafer thin ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic