This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have a situation where I need to change the value of properties file after the successful execution of a program.
I have a filename called myProperties.properties here I have value process.time='03/24/2010' and I have few other values in this property file. What I need to do is change the process.time value after successful execution of a program with out touching other values.
Just read the file into a Properties object, update the property and write it to a file.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
jaisai vijay
Ranch Hand
Joined: Dec 17, 2009
Posts: 70
posted
0
I tried in the following way
The problem is I have some format in the actual file when write the content using ouputstream I lost my format.
You could also do it manually. Or you could store that property in a completely separate file and reduce the risk of trashing your properties file. Or put it in a DB, which is where often-changed values really belong, IMO.
I agree but 1 change at the end of the program is not much. I don't think a DB is the solution because then people can't easily read the content and I'm assuming that's what the poster wants because otherwise we wouldn't mind that the format gets ruined.
jaisai vijay
Ranch Hand
Joined: Dec 17, 2009
Posts: 70
posted
0
Hi,
Thanks for your help guys. As per the replies I have created another properties file and always I update this file only.