-1
In netbeans it finds the normal report, but when I go through the jar, it is not finding.
I have seen some topics here about this problem, but still I could not solve, because they say that is just take the "src" the path of the folder where the report is allocated.
Follows 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");
}
}
This link may be a good suggestion, but your reply will not be valid if one day the link crashes. In addition, it is important for the community to have content right here on the site. It would be better to include more details in your response. A summary of the content of the link would be helpful enough! Learn more about it in this item of our Community FAQ: We want answers that contain only links?
– user28595
The bars are correct yes, because by the IDE it performs normally..
– GabrielBispo
@Gabrielbispo no, they are not. Java itself has a tool to avoid going through this situation. Use
File.separator
. The Jasper interpreter cannot decipher the computer’s OS, so you have to let java check it first.– Gustavo Cinque