Hello everyone,
I am dynamically creating .properties files based on the contents of one .properties file.
I first save the .properties file that contains only keys (not values) using file copy as illustrated here : http://www.exampledepot.com/egs/java.nio/File2File.html
The above method works well, the order of the keys doesn't change.
However, after creating a copy of the file, I load and store values dynamically to it as in the snippet below
Properties myProperties = new Properties();
myProperties .load( new FileInputStream( "fileName") );
emailBeanProperties.setProperty( "myKey", "myValue" );
emailBeanProperties.store( new FileOutputStream( "fileName"), "" );
When I run the above code the order of the keys in the properties files changes, also the lines in between the keys disappear.
Would anyone know how to retain the original order and blank lines in which the keys were first specified when storing values into properties files dynamically?
I will try to test if specifying all values solves this problem
Any help is appreciated.