2015-11-17 72 views
0

我第一次用RMI Connection編寫了Java SWING程序。我已經出口了JAR的客戶端和作品真的很好,但是當我米試圖打開一個特定的JFrame /窗口,它沒有做什麼而我會收到以下錯誤消息用JDateChooser導出jar錯誤

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/toedt 
er/calendar/JDateChooser 
     at clientValantis.MenuPage$2.actionPerformed(MenuPage.java:66) 
     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$500(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$JavaSecurityAccessImpl.doIntersectionP 
rivilege(Unknown Source) 
     at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP 
rivilege(Unknown Source) 
     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$JavaSecurityAccessImpl.doIntersectionP 
rivilege(Unknown Source) 
     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: com.toedter.calendar.JDateChooser 
     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 

JFrame中/窗口,我的程序使用JDateChooser打開,我認爲這是問題。我不知道我必須改變,所以JFrame打開。當我在Eclipse中運行程序時,沒有這個錯誤消息。它的工作非常好。與Build Path有關嗎?

回答

0

您錯過了包含com.toedter.calendar.JDateChooser(可能是jcalendar-1.X.jar)的Jar文件。
你可以使用eclipse創建一個「fat」jar或者像上面提到的here一樣將你的Jar依賴添加到執行類路徑中。
一種選擇是使用Fat Jar Eclipse Plug-In,另一種是使用Maven創建它,如提到的here

+0

我該如何創建這個胖罐......因爲我以爲我已經包含了所有在我的項目構建路徑中的jar – JavaMunich