PropertiesConfiguration class of Apache Commons Configuration 1.10 provides save method which lets you save the updated properties file without deleting the previous values.
In this case the Properties file is present outside of the Jar gets modified by the Jar.
public static void setProperty(String property, String value) {
PropertiesConfiguration conf = null;
try {
conf = new PropertiesConfiguration("./config.properties");
} catch (ConfigurationException e) {
e.printStackTrace();
}
conf.setProperty(property, value);
try {
conf.save();
} catch (ConfigurationException e) {
e.printStackTrace();
}
}