1.读取绝对路径下的配置文件:
FileInputStream fis = new FileInputStream("E:\\log4j.properties");
Properties properties = new Properties();
properties.load(fis);
2.读取相对目录下的配置文件:
URL url = Test.class.getResource("/config/log4j.properties");
Properties properties = new Properties();
properties.load(new InputStreamReader(url.openStream()));

1万+

被折叠的 条评论
为什么被折叠?



