一個錯誤困擾了好多天了,
在Eclipse裏運行沒有問題,使用
Build Fat Jar打包後,運行啓動不了,用java -jar xxx.jar 把jar文件拿出來,總是出現如下錯誤
Uncaught error fetching
image:
JAVA.lang.NullPointerException
at
sun.awt.image.URLImageSource.getConnection(Unknown Source)
at
sun.awt.image.URLImageSource.getDecoder(Unknown Source)
at
sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at
sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at
sun.awt.image.ImageFetcher.run(Unknown Source)
找了許多資料,以上是Eclipse中使用Build Fat Jar打包後找不到圖像造成的(http://bbs.xml.org.cn/blog/more.asp?name=DMman&id=29167&commentid=60339),
於是按照文章提示修改,依然不可以,由於涉及圖片許多,於是放棄了,還是 圖片放在JAR包外新建文件夾裏,這樣程序正常了。