我正在Eclipse中使用Jasper Reports插件生成一个PDF报告。在Eclipse中处理项目时,PDF创建时间大约为5秒。当我将该项目导出为可执行Jar文件并将这些库打包到Jar中时,PDF创建时间将快达3-4分钟。任何想法为什么会发生?提前致谢。如果需要提供其他细节,请告诉我。 (查询返回70行)Jasper Report Pdf在Eclipse中导出ok但从Jar文件很慢
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());
}
}
从Eclipse运行并在外面运行时,您是否使用不同的JDK? – wero
没有相同的JDK。我还应该提到,使用相同的过程,我从另一个类中导出不同的PDF,并且导出时间是几秒钟。从查询中检索的行少于(5-10),但仍然不能解释为此需要5分钟的生产时间。 – GiSm02011