Forums Register Login

setting values in properties file

+Pie Number of slices to send: Send
I am trying to update a value in property file through the following code

Output: updated

But the values doesn't seem to get updated. In Fact, I am not getting any error even if the property or the file itself is not present.
+Pie Number of slices to send: Send
I think, the stream must be closed before setting/updating value. Try this
1
+Pie Number of slices to send: Send
You actually deal with two files with the same name. One is located in the CLASSPATH. The class loader reads it in the method getResourceAsStream("myfile.properties"). The second file is created in the current working directory by the constructor FileOutputStream("myfile.properties"). The first file isn't updated because the value is changed in the second file.
+Pie Number of slices to send: Send
Yup, That's what happening! It works fine if I use OutputStream and InputStream everywhere.
Trust God, but always tether your camel... to this tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 981 times.
Similar Threads
Unable to assign value to Bean property using jsp expression
Droplet Properties
cannot load property file from WAR
Writing data to a file
Java Beans
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:00:27.