I am working on a small Java application that should load / save configuration properties. At first I tried to use the properties file that lived inside the jar, but it bothered me that someone should switch to a later version (replace the existing jar), they will lose all their settings.
My next idea was to write the configuration file to disk and reference it, but I'm not sure where I have to save it. I do not want to use the current directory, because the user can move the jar between directories and forget about the configuration file.
Is there a common location for configuration property files (particularly for windows)? If so, how can I access it (I assume it will be some kind of wild card character, for example% appdata% \ my app \ config.properties)?
Thank!
Kerry source
share