为什么 eclipse 写的游戏打包成 jar 却运行有问题

2018-01-10 01:09:37 +08:00
 emtry

eclipse 里运行:https://blob.steamcn.com/forum/201801/10/010714dv7lyf3ccv1161cp.png

jar 运行: https://blob.steamcn.com/forum/201801/10/010722plhe3hhh7w3hwhrd.png

cmd java -jar 错误如下一直循环 Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at sun.awt.SunToolkit.getImageFromHash(Unknown Source) at sun.awt.SunToolkit.getImage(Unknown Source) at Source.Plane.drawPlane(Plane.java:31) at Source.myFrame.paint(myFrame.java:102) at javax.swing.RepaintManager$4.run(Unknown Source) at javax.swing.RepaintManager$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.access$1200(Unknown Source) at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) 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)

2762 次点击
所在节点    Java
3 条回复
Bryan0Z
2018-01-10 01:21:57 +08:00
你这个异常排版看的头疼,截个图吧,目测是路径问题
flynaj
2018-01-10 10:52:06 +08:00
这个是 java 的特性,一处编写,到处调试
sutra
2018-01-11 15:41:24 +08:00
StackTrace 不完整,看不出来,只能看到个 NPE。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/421540

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX