Venho mais uma vez recorrer ao conhecimento geral do grupo. Tenho um relatório criado no ireport, quando faço a chamada para a visualização do mesmo ele gera um exceção :
importjava.net.URL;importjava.util.HashMap;importjava.util.Map;importjavax.swing.JOptionPane;importnet.sf.jasperreports.engine.*;//para objeto JasperReportimportnet.sf.jasperreports.view.*;//para objeto JasperViewerpublicclassJFTesteextendsjavax.swing.JFrame{privateMapparametros=newHashMap();privateJasperReportrelatorio;privatestaticfinalStringlayout="c:\SisTerm\src\Relatorios\LeituraTermometria.jrxml";//URL arquivo = getClass().getResource("c:\SisTerm\src\Relatorios\LeituraTermometria.jrxml");/** Creates new form JFTeste */publicJFTeste(){initComponents();}/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */@SuppressWarnings("unchecked")// <editor-fold defaultstate="collapsed" desc="Generated Code">privatevoidinitComponents(){jButton1=newjavax.swing.JButton();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);jButton1.setText("jButton1");jButton1.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jButton1ActionPerformed(evt);}});javax.swing.GroupLayoutlayout=newjavax.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(22,22,22).addComponent(jButton1).addContainerGap(305,Short.MAX_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(20,20,20).addComponent(jButton1).addContainerGap(257,Short.MAX_VALUE)));pack();}// </editor-fold>privatevoidjButton1ActionPerformed(java.awt.event.ActionEventevt){VisualizarRelatorio();}/** * @param args the command line arguments */publicstaticvoidmain(Stringargs[]){java.awt.EventQueue.invokeLater(newRunnable(){publicvoidrun(){newJFTeste().setVisible(true);}});}// Variables declaration - do not modifyprivatejavax.swing.JButtonjButton1;// End of variables declarationprivatevoidexibeErro(Stringmsg,Exceptione,booleanfatal){JOptionPane.showMessageDialog(null,msg+"\n"+e.getMessage(),"Erro Fatal",JOptionPane.ERROR_MESSAGE);if(fatal)System.exit(1);}publicvoidVisualizarRelatorio(){try{parametros.put("ParamCodiCabe","16");relatorio=JasperCompileManager.compileReport(layout);JasperPrintimpressao=JasperFillManager.fillReport(relatorio,parametros);JasperViewerviewer=newJasperViewer(impressao,false);viewer.show();}catch(JRExceptionex){exibeErro("Não foi possível visualizar o relatório.",ex,false);}catch(Exceptione){exibeErro("Impossível iniciar a aplicação:",e,true);}}}