I wish to change a property value inside a property file. I tried some ways, such as FileInputStream/FileOutputStream or Apache's library, but all of them alter the file structure.
The structure of my file is:
#[Section 1]
prop1=value1
prop2=value2
#[Section 2]
prop2=value2
prop4=value4
After executing the code, the property changes, but "section" items disappear, and file only consists of a list of unordered properties.
Is there a way to preserve the structure above?
I TRIED THESE WAYS: Updating property value in properties file without deleting other values