Report not found when executing .jar

-1

In netbeans he finds the normal report, but when I go through the jar he is not finding it.

I've seen some topics here about this problem, but I have not been able to solve it, because they say it's just the "src" of the folder path where the report is allocated.

Follow my code:

Connection conn = new SQLConnection().java_db();
if(!jComboBox1.getSelectedItem().equals("Selecione...")&&procurar1.getDate()!= null && procurar2.getDate()!=null){
Map p = new HashMap();
p.put("tipoteste", jComboBox1.getSelectedItem());
p.put("dataini", procurar1.getDate());
p.put("datafim", procurar2.getDate());
JasperReport relatorio;
JasperPrint impressao;

try {
    relatorio = JasperCompileManager.compileReport(new File("").getAbsolutePath()
            + "/Relatorios/reprovadosgeral.jrxml");

    impressao = JasperFillManager.fillReport(relatorio, p, conn);
    JasperViewer view = new JasperViewer(impressao, false);
    view.setTitle("Relatório Reprovados");
    view.setVisible(true);


} catch (Exception e) {

}
}else
{
    JOptionPane.showMessageDialog(null, "Preencha todos os campos");
}
}
    
asked by anonymous 18.04.2018 / 12:54

1 answer

-2

Depending on the environment where you are running .jar, it can be a problem with folder orientation, while Linux uses "/", in Windows it uses "\".

See more at Live Linux .

    
18.04.2018 / 16:41