Search code examples
javaoperating-systemsettingsconfiguration-files

Saving user settings/database/cache... in Java (On every OS)


My Java application is saving stuff in 'user.home' but on windows this does not seem to be the correct path to save application information (as a friend told me). An other option is using the preferences api but it's not possible to set up the hsqldb location using the preferences api. Also, I want all files to be available in the same folder (local database, config, cache, ...).

I'm looking for some example code or a framework that takes care of os-specific stuff.


Solution

  • On my WinXP Pro SP3 system, user.home points to C:\Documents and settings\<username> Lot of applications just store their data there (instead of this path + Application data, but some others go down to there), creating a directory in Unix style, ie. dot + application name (examples: .antexplorer, .sqlworkbench, .squirrel-sql, .SunDownloadManager, .p4qt, .gimp-2.4, etc.).

    Looks like a decent, common practice...