本文主要是介绍接上篇,访问资源文件,获取内容,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
找到资源文件位置后,获取里面的属性键值对
/*
*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");
这篇关于接上篇,访问资源文件,获取内容的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!