我正在使用 NetBeans。我有一个简单的项目,它以花哨的格式打印一些作为参数发送的数据。这是引发异常的代码:
JasperDesign design = JRXmlLoader.load("Certificate.jrxml");
JasperReport report = JasperCompileManager.compileReport(design);
JasperPrint print = JasperFillManager.fillReport(report, new HashMap(), new ClientList(args).getClients());
JPanel panel= new JRViewer(print);
每当创建 Jasper 类时都会引发这些异常。我还尝试了 System.getProperty("java.class.path") 它包含“jasperreports-5.0.1.jar”文件。我做错了什么?我知道只要类在编译时可用,但在运行时不可用,就会抛出这些异常。但是 jar 就在那里!
请求的堆栈跟踪:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
at certificado.Certificado.main(Certificado.java:31)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.digester.Digester
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 1 more
Java Result: 1