Jasper Report Pdf Export in Eclipse ok but from Ja

2019-08-06 05:53发布

I am generating a Pdf report using Jasper Reports plugin in Eclipse. While working on the project in Eclipse the PDF creation time is approximately 5 seconds. When I export the project into an executable Jar file with the libraries packaged in the Jar the PDF creation time goes up to almost 3-4 minutes. Any ideas why that happens? Thanks in advance. If any other details should be provided please let me know. (Query returns 70 rows)

try{
                        Connection connection=null;
                        connection=dbConnect.dbConnector();
                        String year comboBox_1.getSelectedItem().toString();                               
                        String items = textField_1.getText().toString();
                        String amount = textField_2.getText().toString();
                        Map parametersMap = new HashMap();      
                        parametersMap.put("year",year);
                        parametersMap.put("items",items);
                        parametersMap.put("amount",amount);
                        String reportPath = "C:\\Users\\Panagiotis\\workspace\\OceanBlue\\SalesReportYear.jrxml";
                        JasperReport jr = JasperCompileManager.compileReport(reportPath);
                        JasperPrint jp = JasperFillManager.fillReport(jr,parametersMap,connection);
                        JasperExportManager.exportReportToPdfFile(jp, "C:\\Users\\Panagiotis\\Desktop\\SaleReport"+textField_3.getText()+".pdf");
                        connection.close();
                        }
                        catch(Exception ex){    
                        System.out.println(ex.getMessage());
                        }
                }

1条回答
虎瘦雄心在
2楼-- · 2019-08-06 06:44

So the solution.........after wero mentioning JDK above I checked the JDK of Windows, Eclipse and Jasper Reports Studio. It was different for the Jasperreports. Corrected it and now the exporting time of the pdf is 5 secs average. Simple as that. Thanks wero!

查看更多
登录 后发表回答