How to includes all images in jar file using eclipse

后端 未结 4 1611
生来不讨喜
生来不讨喜 2020-11-29 10:38

I made a java application and bundled all classes in a jar file. When I run the project from eclipse, my application is running successfully. But when I try to run my

4条回答
  •  情书的邮戳
    2020-11-29 11:03

    The files in jar files are treated as "Resources". you need to access them as a classpath resource, regular File access methods does not work there.

    Try this:

    final public ImageIcon iReport = (new ImageIcon(getClass().getResource("images/Report.png")));
    

提交回复
热议问题