下面的代码是对resource.properties文件进行读操作:
InputStream input= this.getClass().getClassLoader().getResourceAsStream("resource.properties");
try{
props.load(input);
}catch(Exception e){
System.err.println("CheckLogin:不能读取属性文件. " + "请确保resource.properties在CLASSPATH指定的路径中");
}
this.midaUser = props.getProperty("User");
this.midaPassword = props.getProperty("Password");
即分别读取该文件中User和Password的值,现在想对User和Password的值进行修改
最后
以上就是曾经月光最近收集整理的关于如何CLASSPATH下的resource.properties文件进行读写操作?的全部内容,更多相关如何CLASSPATH下内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复