|
Problem with a report
I had don a report in iReport and i wont to put in a java file.
I did this button and this acction:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String raport = "./rapoarte/classic.jasper";
String outFileName = "/rapoarte/raport1.pdf";
HashMap hm = new HashMap();
String edit, anul, anul1;
hm.put("nume", edit);
hm.put("prenume", anul);
hm.put("data_internare",anul1);
try {
JasperReport jasperReport = JasperCompileManager.compileReport(raport);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, hm, cnx);
JasperViewer.viewReport(jasperPrint, false);
}
catch (JRException ex) {
ex.printStackTrace();
}
}
I have an error in this lines:
hm.put("nume", edit);
hm.put("prenume", anul);
hm.put("data_internare",anul1);
variable edit might not have been initialized
Help me please
|