Java读取包内包外的配置文件

来源:互联网 发布:a href js 函数 编辑:程序博客网 时间:2024/06/05 13:23

1. 读取Jar包内配置文件:

InputStream in = this.getClass().getClassLoader().getResourcesAsStream("/configu.properties");

2. 读取Jar包外配置文件:
String file = System.getproperty("user.dir") + "/conf/configue.properties";InputStream in = new BufferedInputStream(new FileInputStream(file));

0 0
原创粉丝点击