File f
=
new
File(
"
c:\\my.properties
"
);
Properties prop
=
new
Properties();
if
(f.exists()) {
try
{
InputStream in
=
new
FileInputStream(f);
prop.load(in);
in.close();
System.out.println(prop.get(
"
requestTime
"
));
//
读properties文件
OutputStream out
=
new
FileOutputStream(f);
prop.setProperty(
"
derek
"
,
"
dada
"
);
//
设置属性
prop.store(out,
"
THE LOCKED TIME SET
"
);
//
写properties文件
}
catch
(FileNotFoundException ex) {ex.printStackTrace();
}
catch
(IOException ex) {ex.printStackTrace();}
}
else
System.out.println(
"
文件不存在
"
);
posted on 2006-04-06 18:58
Derek.Guo 阅读(381)
评论(0) 编辑 收藏 所属分类:
Java