Eclipse getResourceAsStream returning null

后端 未结 6 1778
鱼传尺愫
鱼传尺愫 2020-12-10 04:15

I cannot get getResourceAsStream to find a file. I have put the file in the top level dir, target dir, etc, etc and have tried it with a \"/\" in front as well. Everytime

6条回答
  •  孤街浪徒
    2020-12-10 05:07

    Old question but I just had the same problem and none of the answers worked for me (or I didn't understand them).

    In Eclipse, refresh the project directory to make Eclipse aware that a new file has been added to resources. For this, right-click on the project (topmost) directory in the package explorer view, then hit "Refresh". The same if you edit an existing resource file from outside eclipse: refresh to make eclipse aware of the edits.

提交回复
热议问题