How to walk through Java class resources?

后端 未结 5 1995
栀梦
栀梦 2020-12-13 20:35

I know we can do something like this:

Class.class.getResourceAsStream(\"/com/youcompany/yourapp/module/someresource.conf\")

to read the fil

5条回答
  •  不知归路
    2020-12-13 21:39

    I usually use

    getClass().getClassLoader().getResourceAsStream(...)
    

    but I doubt you can list the entries from the classpath, without knowing them a priori.

提交回复
热议问题