0
當我嘗試從cmd打開.JAR文件時,爲什麼會出現此錯誤?執行jar文件時出錯
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at sqlprojectgestor.Gestor.initComponents(Gestor.java:311)
at sqlprojectgestor.Gestor.<init>(Gestor.java:28)
at sqlprojectgestor.Gestor.lambda$main$0(Gestor.java:1017)
at java.awt.event.InvocationEvent.dispatch(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.doIntersectionPrivilege(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)
我嘗試運行與雙擊.jar文件,但它不會打開...
它看起來像是在你的代碼中發生錯誤。爲了調試它,我們需要看代碼。你可以在沒有問題的情況下從IDE運行代碼嗎? – nhouser9
我認爲錯誤在你的圖像路徑中。嘗試使用相對路徑。 –
如果我從netbeans運行我的程序,運行時沒有錯誤,這就是爲什麼我覺得它很奇怪:/ @ nhouser9 –