Accessing gradle resources from Java

后端 未结 3 2185
一整个雨季
一整个雨季 2021-02-19 08:17

I have a gradle-based java project with this structure

.
├── myproject
│      ├── src
│      |    └── main
│      |         ├── java
│      |         └── resourc         


        
3条回答
  •  自闭症患者
    2021-02-19 08:57

    http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getResource(java.lang.String)

    For example something like MyMain.class.getResource("/config.txt") or use relative path when appropriate.

提交回复
热议问题