I would like to know if its possible to edit a properties file after the project is deployed. I tried editing the values in the properties file using a classloader.
ClassLoader classLoader = this.getClass().getClassLoader(); prop.load(classLoader.getResourceAsStream("test.properties"));
It reads the values properly but I couldn't write it back to the file. I used the following code to write the values back.
prop.setProperty("myValue", one); FileOutputStream outfile = new FileOutputStream("test.properties"); prop.store(outfile, null); outfile.close();
The problem is that it stores/updates the file in bin directory of Tomcat. How can i use a relative path to edit and change the values of the file which is in source package? What is the location that must be used to store a properties file?
Thanks in advance!