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

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

  •  
  •   emtry · 2018-01-10 01:09:37 +08:00 · 2762 次点击
    这是一个创建于 2496 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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
    Bryan0Z
        1
    Bryan0Z  
       2018-01-10 01:21:57 +08:00 via Android
    你这个异常排版看的头疼,截个图吧,目测是路径问题
    flynaj
        2
    flynaj  
       2018-01-10 10:52:06 +08:00 via Android
    这个是 java 的特性,一处编写,到处调试
    sutra
        3
    sutra  
       2018-01-11 15:41:24 +08:00
    StackTrace 不完整,看不出来,只能看到个 NPE。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2626 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 03:20 · PVG 11:20 · LAX 19:20 · JFK 22:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.