JasperReport in java jar file

0

I have a java .jar file that was created using Eclipse.  I have two Jasper reports

which run perfectly when I am inside the Eclipse IDE, but after exporting the program

to a .jar file, the reports will not show any data.  I get no errors.  When I press the button to generate the report, I get nothing.

The code for the button is below.  These are compiled jasper files.  They were compiled using iReports 5.1

I am using Jasper Reports Library 5.1.2.  

I am running Eclipse 4.2.0 on Windows 7 Enterprise

I have looked all over the internet with no luck.  As I said earlier, everything works fine in Eclipse, but not from the standalone .jar file.

I sure would be happy if someone could tell me what I am missing here.

Thanks,

Monty

<code>

Connection connect;

String fileName = "All_Dist_By_Del_dt.jasper";
// String outFileName = "DistByRecipient.pdf";
HashMap<String, Object> hm = new HashMap<String, Object>();
try {
Class.forName("com.mysql.jdbc.Driver");
// Setup the connection with the DB
connect = DriverManager.getConnection("jdbc:mysql://localhost/database", "user", "password");
 
JasperPrint print = JasperFillManager.fillReport(fileName, hm,connect);
 
// view report in the JasperViewer
JasperViewer.viewReport(print, false);
 
} catch (JRException f) {
f.printStackTrace();
JOptionPane.showMessageDialog(null, "Jasper Reports error: "
+ f.getMessage(), "Report Error",
JOptionPane.ERROR_MESSAGE);
} catch (ClassNotFoundException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
 
}
 

</code>

monty.love's picture
Joined: Jun 25 2013 - 9:06am
Last seen: 1 year 5 months ago

0 Answers:

No answers yet
Feedback
randomness