public void ejecutarReporte(String codigo) { try { cn = Conexion.realizarConexion(); String master = System.getProperty("user.dir") + "\\src\\reportes\\reporteEmpleado.jasper"; System.out.println("master: " + master); if (master == null) { showMessageDialog(null, "No se encontro el archivo", "Error", 0); System.exit(2); } JasperReport masterReport = null; try { masterReport = (JasperReport) JRLoader.loadObject(master); } catch (JRException ex) { showMessageDialog(null, "MasterReport:" + ex.getMessage(), "Error", 0); System.exit(3); } Map parametro = new HashMap(); parametro.put("chr_emplcodigo", codigo); JasperPrint jasperPrint = JasperFillManager.fillReport(masterReport, parametro, cn); JasperViewer jviewer = new JasperViewer(jasperPrint, false); jviewer.setTitle("Reporte"); jviewer.setVisible(true); } catch (ClassNotFoundException ex) { showMessageDialog(null, ex.getMessage(), "Error", 0); } catch (SQLException ex) { showMessageDialog(null, ex.getMessage(), "Error", 0); } catch (Exception ex) { showMessageDialog(null, ex.getMessage(), "Error", 0); } finally { try { cn.close(); } catch (Exception ex) { showMessageDialog(null, ex.getMessage(), "Error", 0); } } }