接上篇,访问资源文件,获取内容

来源:互联网 发布:广告单设计软件 编辑:程序博客网 时间:2024/05/01 17:18

找到资源文件位置后,获取里面的属性键值对

/* *path需要加上合适的后缀,据自己的需要   */path=this.getClass().getResource("/").getPath()+"";InputStream inputStream = new FileInputStream(path);Properties properties = new Properties();properties.load(inputStream);inputStream.close();String p1 = properties.getProperty("p1name");
0 0