当我尝试从cmd打开.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文件但不会打开...
答案 0 :(得分:0)
我怀疑您的问题是由于您的JAR中不包含图片造成的。请参阅此问题以了解如何执行此操作:可能是您未将图像作为资源包含在JAR中。请参阅此问题:Add image to JAR Java