Eclipse exported Runnable JAR not showing images

后端 未结 8 1757
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 16:46

My images will not load when running a JAR file exported from Eclipse.

I have the images in a resources class package. I\'ve tried a images source folder as well wit

8条回答
  •  无人共我
    2020-11-22 17:22

    Two Simple steps:

    1 - Add the folder to Build Path;

    2 - Use this:

        InputStream url = this.getClass().getResourceAsStream("/load04.gif");
        myImageView.setImage(new Image(url));
    

提交回复
热议问题