(1)在本地运行时:
String path = this.getClass().getResource("/config/config.txt")
.getPath();
(2)在web运行时:
String path = this.getClass().getClassLoader()
.getResource("/").getPath() + "/config/config.txt";
-----------
待验证:
https://my.oschina.net/airship/blog/1540753