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 閱讀(387)
評論(0) 編輯 收藏 所屬分類:
Java