Why does getResource return null

后端 未结 5 1658
感情败类
感情败类 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条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-05 23:39

    Try using / prefixing.

    Thread.currentThread().getContextClassLoader().getResourceAsStream("/xxx.png")

提交回复
热议问题