java 读取配置文件例子

只谈情不闲聊 提交于 2020-02-12 15:15:06
File f = new File(this.getClass().getResource("/").getPath()+"xxx.properties");
try( FileInputStream d=new FileInputStream(f)) {
    Properties properties=new Properties();
    properties.load(d);
    System.out.println(f.toString());
    System.out.println(properties.getProperty("com.outpupath"));
}  catch (IOException e) {
    e.printStackTrace();
}

配置文件在resource文件下

内容
com.outpupath=E:/x/xxxx.xlsx

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!