how do you make getResourceAsStream work while debugging Java in Eclipse?

后端 未结 6 1186
清酒与你
清酒与你 2020-12-03 06:05

This is mind-boggling... I can make getResource() and getResourceAsStream() work properly when I run Java on my packaged JAR file that includes a text file. (for reference s

6条回答
  •  半阙折子戏
    2020-12-03 07:03

    Found the problem!

    I did have my image files in the source tree. (in my Ant build, I copy them to the build dir)

    The problem was that I had not done a recent refresh of the source tree in Eclipse. So the files were there but Eclipse wasn't paying any attention to them.

    Thanks for clueing me in to the fact that Eclipse should have them in my source tree.

提交回复
热议问题