How to delete key and value from property file? My property file has these contents:
key1=value1
key2=value2
I used the below code to delete the entry key2=value2
. After that, now the file has these values:
key1=value1
key2=value2
Wed Mar 06 12:36:32 IST 2013
key1=value1
java code to remove an entry:
FileOutputStream out1 = new FileOutputStream(file, true);
prop.remove(key);
prop.store(out1,null);
What is the mistake am doing. How to clear the whole content of the file before writing it.