Christian Koncilia wrote:
Hello everybody,
I have a question regarding the Commons Configuration. Let's assume I
have a configuration file "myprops.properties" that looks like this:
-------------------------
# written by PropertiesConfiguration
# Mon Aug 07 08:29:12 CEST 2006
group1.entry1 = value1
group1.entry2 = value2
group1.entry3 = value3
-------------------------
Now I would like to simply delete an entry. For instance, I would like
to remove the whole line "group1.entry2 = value2" from my properties
file. How do I do this?
Using
PropertiesConfiguration config =
new PropertiesConfiguration("myprops.properties");
config.clearProperty("group1.entry2 = value2");
config.save();
doesn't work.
Thanks for your help!
Bye
Christian
You only need to pass in the key of the property you want to delete to
clearProperty(), so the line in question should run:
config.clearProperty("group1.entry2");
HTH
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]