This question already has answers here:
minimum dependencies for JasperReports
                            
                                (1个答案)
                            
                    
                    
                        JasperReports optional dependencies
                            
                                (1个答案)
                            
                    
                    
                        What are the dependecy need to be added for jasperreport 5.0.1?
                            
                                (2个答案)
                            
                    
                去年关闭。
        

    

我正在为此代码使用JasperReport。

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JRDesignQuery;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;

    public void printData(String report , String printQuery){
        try{
            jasperDesign = JRXmlLoader.load(report);
            query.setText(printQuery);
            jasperDesign.setQuery(query);
            jr = JasperCompileManager.compileReport(jasperDesign);
            jp = JasperFillManager.fillReport(jr,null, databaseHandler.getConnection());
            JasperViewer.viewReport(jp,false);

        }catch (JRException ex) {
            AlertMaker.showException("Exception Occurred ! " , ex.toString());
        }
    }


谁能帮助我说说java项目中必须包含哪个jar库文件?
因为包含所有JasperReport jar文件会降低项目性能(这些jar lib文件超过60个)

最佳答案

基本上,这些是强制性jar,其余的可以根据需要添加。

......poi-3.7-20101029.jar        ###support poi
......commons-beanutils-1.8.0.jar
......commons-collections-3.2.1.jar  ## for Collections
......commons-digester-2.1.jar
......commons-javaflow-20060411.jar
......commons-logging-1.1.1.jar        ### for logging's
......groovy-all-2.0.1.jar
......iText-2.1.7.js2.jar                ### for pdf
......jcommon-1.0.15.jar
......jfreechart-1.0.12.jar

09-25 21:39