Yunus Einsteinium Yunus Einsteinium - 2 months ago 7x
Java Question

Apache Commons Configuration Cant save

I am using Apache Commons Configuration to keep some properties in a properties file located in a package


private PropertiesConfiguration configs = new PropertiesConfiguration("re/iprocu/coperativeerp/config/payment/");
configs.setProperty(date.getYear()+"-"+date.getMonthValue()+"-01", offsetMember);

The problem is when i run the above code i get the following error

Exception in thread "JavaFX Application Thread" org.apache.commons.configuration.ConfigurationRuntimeException: Failed to auto-save
at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(
at org.apache.commons.configuration.AbstractFileConfiguration.clearProperty(
at org.apache.commons.configuration.AbstractConfiguration.setProperty(
at org.apache.commons.configuration.AbstractFileConfiguration.setProperty(


Apache Commons Configuration V. 1.10

Maven dependency



You cannot save a configuration that points to a file within a JAR. Try using a configuration file that is located outside of your JAR and you'll see that auto-save option works correctly.


You can put the file both in a JAR and in the same relative path in one of the default locations. Here's what the documentation says.

If you do not specify an absolute path, the file will be searched automatically in the following locations:

  • in the current directory
  • in the user home directory
  • in the classpath

So, if for instance you have a default properties file in you JAR, located at conf/, you can put the properties either in user's home directory under the same relative path - e.g. on Linux /home/username/conf/ or in the same directory with your JAR file. Both should be secure enough.