首页   注册   登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  Java

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

  •  
  •   emtry · 188 天前 · 1022 次点击
    这是一个创建于 188 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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)

    3 回复  |  直到 2018-01-11 15:41:24 +08:00
        1
    Bryan0Z   188 天前 via Android
    你这个异常排版看的头疼,截个图吧,目测是路径问题
        2
    flynaj   187 天前 via Android
    这个是 java 的特性,一处编写,到处调试
        3
    sutra   186 天前
    StackTrace 不完整,看不出来,只能看到个 NPE。
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   鸣谢   ·   实用小工具   ·   2982 人在线   最高记录 3541   ·  
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.1 · 16ms · UTC 01:42 · PVG 09:42 · LAX 18:42 · JFK 21:42
    ♥ Do have faith in what you're doing.
    沪ICP备16043287号-1