Jasper报告Pdf导出在Eclipse中,但是从Jar文件很慢 [英] Jasper Report Pdf Export in Eclipse ok but from Jar file very slow

查看:158
本文介绍了Jasper报告Pdf导出在Eclipse中,但是从Jar文件很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中使用Jasper Reports插件生成一个Pdf报告。在Eclipse中的项目中,PDF创建时间约为5秒。当我将项目导出到可执行的Jar文件中时,库中包装有Jar,PDF创建时间可达3-4分钟。任何想法为什么会发生?提前致谢。如果有任何其他细节应该提供,请让我知道。 (查询返回70行)

  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:\\\\\Panagiotis\\Desktop\\SaleReport+ textField_3.getText()+。pdf);
connection.close();
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
}


解决方案

解决方案.........在wero上面提到JDK之后,我检查了Windows,Eclipse和Jasper Reports Studio的JDK。对于Jasperreports来说是不同的。更正了它,现在pdf的出口时间平均为5秒。就那么简单。谢谢wero!


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());
                        }
                }

解决方案

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!

这篇关于Jasper报告Pdf导出在Eclipse中,但是从Jar文件很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆