At the time of writing, application changes to .properties are sometimes postponed by unnecessary and unused lines. How can they be cleaned . So not with pens, but without losing the necessary data. Is it possible?

  • It seems to me easier to write my solution for these specialized needs. I had to do something like this by a PropertyManager that managed to write a record by reading the configuration. and the parameter set was stored as constants in enum. then go through the array of constants and read / write their values ​​to a file - jmu

1 answer 1

Well, if you keep somewhere all the active keys, then by renumbering the keys through ResourceBundle.getKeys() you can understand which ones are unnecessary, then translate into Properties objects and use Properties.store() clean up unnecessary ones.

But IMHO it's all expensive, easier hand to hand through the editor.