Java program does not find jasper report path

2

I did a small program in java to generate budget reports, I used jasper Ireport to do so, I did, I tested, it generated budgets everything working on my computer. When I installed it on a friend's computer it worked fine except for the reports, nor even appears blank, it looks like this:

Inthecode,theimagepath,itseems,issetcorrectly.

publicvoidimprimeRelatorio(){ConexaoMySqlco=newConexaoMySql();co.setUrl("jdbc:mysql://localhost:3306/poc");
        co.setUsuario("root");
        co.setSenha("");

         String src = "C:\orcamento.jasper";


        Map<String, Object> parametros = new HashMap<String, Object>();
        parametros.put("id",(Integer.parseInt(inpId.getText())));
          System.out.println("parametros="+parametros);


      JasperPrint jasperPrint = null;
        try {
            jasperPrint = JasperFillManager.fillReport(src, parametros, co.getConnection());
        } catch (JRException ex) {
            Logger.getLogger(TelaControle.class.getName()).log(Level.SEVERE, null, ex);
        }
        JasperViewer view = new JasperViewer(jasperPrint, false);
        view.setVisible(true);
        System.out.println("view" +view);

    }

Iranthecmdtoseetheoutputandactuallythepathoftheimageseemstobecorrect.

The strangest thing is that on my computer it works normally.

    
asked by anonymous 16.08.2017 / 05:21

1 answer

2

Two were the mistakes: as the windows of that machine is configured not to show the extension of the files, the file name was divergent, so I renamed the file to only orcamento .

The second error was in the report file itself because it contained a logo that was in the path of the folders on the other computer. When I fixed that, I solved the problem and generated the reports normally. Thank you.

    
16.08.2017 / 06:27