Why does getResource return null

后端 未结 5 1741
感情败类
感情败类 2021-01-05 23:22

I\'m trying to access a file in my project. But getResource method returns null.

This is how my project looks like:

5条回答
  •  旧时难觅i
    2021-01-05 23:46

    Is there a reason you're using the the class loader of the current class? Something like this.getClass().getClassLoader().getResource("/xxx.png") should be more reliable.

提交回复
热议问题