Forums Register Login

setting values in properties file

+Pie Number of slices to send: Send
Hi,

I want to know is it possible to set the values in a properties file thru java program?
The scenario is like this: i'm getting 2 or more product id's from xml. Now i've to display a proper message where that 2 product_id will be inserted. The message is already defined in the properties file as a template. Now i've written the properties file like this:

That product1 & product2 value should come from xml.How can i do this?

Another thing is that,i'm using eclipse and its giving error:

Where i've to keep the properties file? i've tried keeping it at the same place where java files are residing, in a different folder outside the package...but its giving the same error...

please help
+Pie Number of slices to send: Send
The Properties class has a store() method to write out to a file. Read your properties file in, manipulate the properties as you need then call store().


Where i've to keep the properties file? i've tried keeping it at the same place where java files are residing, in a different folder outside the package...but its giving the same error...


Basically, in the classpath. It looks like you are using a ResourceBundle; are you loading it via the getBundle() method? The JavaDocs explain the logic behind finding the file.
+Pie Number of slices to send: Send
In case your application is not Locale aware then you can just use file inputstream to read the .properties file to a Properties object and the manipulate that.
[ April 23, 2007: Message edited by: Rahul Bhattacharjee ]
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1904 times.
Similar Threads
Beginner Java Question
Correlation in SQL to distinguish tables
Help wit h code
Sorting arrays
RMI 001
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:35:29.