您的位置:首页 > 编程语言 > Java开发

java代码读取properties文件

2015-08-17 10:05 567 查看
配置文件



配置文件内容

#the mention movetype
sendimpmovetype=261,161


读取的java代码:

private String loadMovetypeSetting(){
try{
Properties propsConfig = new Properties();
InputStream inputStream=this.getClass().getResourceAsStream("/peijianConfig.properties");
propsConfig.load(inputStream);
String moveType=propsConfig.getProperty("sendimpmovetype");
inputStream.close();
return moveType;
}catch(Exception e){
e.printStackTrace();
}
return null;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: