Jasper does not open outside the IDE

1

Inside the NetBeans IDE, the code works and the report is displayed. But when generating the executable, it is not possible to open the report, receiving the null message. It's like he can not find the report.

public ClienteREL() {
    this.path = this.getClass().getClassLoader().getResource("").getPath();
    this.pathToReportPackage = this.path + "br/com/prologica/report/";


            System.out.println(this.pathToReportPackage);

}


//Imprime/gera uma lista de Clientes
public void imprimir(List<Cliente> clientes) throws Exception   
{
    JasperReport report = JasperCompileManager.compileReport(this.getPathToReportPackage() + "imprimir.jrxml");

            JasperPrint print = JasperFillManager.fillReport(report, null, new JRBeanCollectionDataSource(clientes));

            JasperPrintManager jasperPrintManager = null;
            jasperPrintManager.printReport(print, false);

}

    
asked by anonymous 23.06.2016 / 19:16

1 answer

1

This is clearly some Classpath problem. NetBeans underneath runs the JAR also by command line. So I would have to see how it does.

I recommend you start by trying to manually run the JAR generated by NetBeans inside the " dist " folder of your project. If that works, copy the folder " dist " with everything in there (including the folder " dist/libs ") to another place and try to execute it.

If this goes wrong, please try to create a minimal, complete, and verifiable example of your issue.

    
23.06.2016 / 20:57