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/configurations.properties");
Exception in thread "JavaFX Application Thread" org.apache.commons.configuration.ConfigurationRuntimeException: Failed to auto-save
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/configuration.properties, you can put the properties either in user's home directory under the same relative path - e.g. on Linux
/home/username/conf/configuration.properties or in the same directory with your JAR file. Both should be secure enough.