我已经创建了Jasper报告,但是我不知道如何在Java Swing应用程序中添加按钮来保存此报告?
那是我已经尝试过的方法,但是没有用:
Class.forName(driverName);
Connection con = DriverManager.getConnection(url, userName, password);
InputStream in = new FileInputStream(new File("Documents\\NetBeansProjects\\src\\Reports\\RezultatiTestit.jrxml"));
JasperDesign jd = JRXmlLoader.load(in);
String sql = "SELECT Name from EMP";
JRDesignQuery newQuery = new JRDesignQuery();
newQuery.setText(sql);
jd.setQuery(newQuery);
JasperReport jr = JasperCompileManager.compileReport(jd);
HashMap para = new HashMap();
JasperPrint j = JasperFillManager.fillReport(jr, para, con);
JasperViewer.viewReport(j, false);
OutputStream os = new FileOutputStream(new File("Documents\\NetBeansProjects\\src\\Reports"));
JasperExportManager.exportReportToPdfStream(j, os);
线程“ AWT-EventQueue-0”中的异常java.lang.NoClassDefFoundError:org / springframework / beans / factory / support / BeanDefinitionRegistry 在java.lang.Class.forName0(本机方法)