Hi Oliver,

thats what I tried before but it doesn't work neither. Another strange thing, 
if I use "config.clear()" to clear the whole properties file, everything 
except(!) the last thing I read is deleted...

This looks to me like some internal bug. Or do you have another idea?

Bye
    Christian

-----Ursprüngliche Nachricht-----
Von: Oliver Heger [mailto:[EMAIL PROTECTED]
Gesendet: Mo 07.08.2006 21:53
An: Jakarta Commons Users List
Betreff: Re: Commons Configuration: delete entry
 
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]


Reply via email to