Jasper does not open outside the IDE

Asked

Viewed 470 times

1

Within the Netbeans IDE the code works and the report is presented. But when generating the executable, it is not possible to open the report, receiving the null message.
It’s like he can’t trace 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);

}

inserir a descrição da imagem aqui

  • Are you generating a jar? If so, try running it straight from the prompt and see if any errors are popping.

  • 'cause buddy, running on the console is like he can’t find the report.

  • Running the jar on the console displays nothing either?

  • nothing... but inside go right

1 answer

1

This is clearly some Classpath problem. Netbeans runs the JAR under the table as well. Then you’d have to see how he does.

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

If this goes wrong, please try creating an example minimum, complete and verifiable of your problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.