Ola, estou gerando um relatorio de produtos, ele abre normalmento quando compilo no netbeans 7.1porém quando mando limpar e construir,
o arquivo .jar nao puxa os relatorios e não da mensagem de erro nem nada fica como se o jButton nao tivesse nenhum evento.
Como faço para o arquivo .jar puxe os relatorios?
public class CriaConexao {
static Connection con = null;
public static Connection conectar() {
try {
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/banco", "root", "****");
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return con;
}
public static void geraRelatorio(String arquivo) throws JRException, SQLException, ClassNotFoundException {
HashMap map = new HashMap();
JasperReport report = (JasperReport) JRLoader.loadObject(arquivo) ;
JasperPrint imprimir = JasperFillManager.fillReport(report, map, conectar());
JasperViewer jrviewer = new JasperViewer(imprimir, false);
jrviewer.setVisible(true);
}
}
private void mostrarRelatorio() {
try{
System.out.print(getClass().getClassLoader().getResource("Relatorio/RelatorioDeProdutos.jrxml").getPath());
CriaConexao.geraRelatorio(getClass().getClassLoader().getResource("Relatorio/RelatorioDeProdutos.jasper").getPath());
}catch(Exception e){
System.out.println(e);
}
}