2012-11-12 80 views
0

在我的應用程序中,我使用jasper報告來創建報告,但是當我將應用程序構建到jar文件時,jar文件無法讀取jasper文件,我已經包含了jasper庫和所有他們需要的庫,放置在JRXML文件中的庫文件夾,但它仍然無法工作,,,爲什麼jasper報告不能導出到jar文件中?

在這裏的錯誤,當我在命令提示符下運行:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: net/sf/ja 
    sperreports/engine/JasperManager 

    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) 
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) 
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) 
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source) 
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour 
    ce) 
    at java.awt.Component.processMouseEvent(Unknown Source) 
    at javax.swing.JComponent.processMouseEvent(Unknown Source) 
    at java.awt.Component.processEvent(Unknown Source) 
    at java.awt.Container.processEvent(Unknown Source) 
    at java.awt.Component.dispatchEventImpl(Unknown Source) 
    at java.awt.Container.dispatchEventImpl(Unknown Source) 
    at java.awt.Component.dispatchEvent(Unknown Source) 
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) 
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) 
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) 
    at java.awt.Container.dispatchEventImpl(Unknown Source) 
    at java.awt.Window.dispatchEventImpl(Unknown Source) 
    at java.awt.Component.dispatchEvent(Unknown Source) 
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source) 
    at java.awt.EventQueue.access$200(Unknown Source) 
    at java.awt.EventQueue$3.run(Unknown Source) 
    at java.awt.EventQueue$3.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour 
    ce) 
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour 
    ce) 
    at java.awt.EventQueue$4.run(Unknown Source) 
    at java.awt.EventQueue$4.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour 
    ce) 
    at java.awt.EventQueue.dispatchEvent(Unknown Source) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.run(Unknown Source) 
    Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JasperM 
    anager 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    ... 37 more 
+2

儘管你有保證,很明顯'net.sf.jasperreports.engine.JasperManager'在應用程序的** run-time **類路徑上不是***。查看它通常位於[JarFinder]中的Jar(http://www.jarfinder.com/index.php/java/info/net.sf.jasperreports.engine.JasperManager)。 –

+0

是沒有找到任何類路徑,或者您沒有在這裏添加正確的lib http://grepcode.com/snapshot/repo1.maven.org/maven2/net.sf.jasperreports/jasperreports/4.7.1/ –

+0

我是使用jasperreport 3.75,我應該改變類型嗎? – Ayharu

回答

0

java.lang.NoClassDefFoundError:類不在CLASSPATH中。
那個menas et/sf/jasperreports/engine/JasperManager類不在你的類路徑中。
檢查你的班級路徑,所需的罐子在那裏..?

相關問題