Open Jasper report

0

I'm trying to open a .jasper report, but it only opens in BlueJ, the editor I'm using. When I open the file, it is already in .jar the report .jasper does not open ... What am I doing wrong?

Next to file .jar I have the jasper/relatorio1.jasper directory

methodReport ()

import java.sql.Connection;
import java.util.HashMap;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.JRException;

public class AbreRelatorio
{
public void metodoAbreRelatorio(){ 

LigacaoBD ligacaoBD = new LigacaoBD();
Connection con = ligacaoBD.obterLigacao();

try{
    HashMap parametros = new HashMap();
    JasperPrint jp = JasperFillManager.fillReport("jasper/relatorio1.jasper", parametros, con);
    JasperViewer jrv = new JasperViewer(jp, false);//para a main janela nao fechar
    jrv.setVisible(true);
}
catch(JRException jre){
    System.out.println("JRException");
    jre.printStackTrace();

}
ligacaoBD.fecharLigacao(con);
}
}

Solution I solved the problem by importing the correct libraries from jasperreport into my project.

Image of my librarie

    
asked by anonymous 05.05.2018 / 00:03

0 answers