Reputation: 121
I am developing a medium Java desktop application, without using a database. I am using xml, serializable objects, etc. to store the user/application data, but what is the right location to save these files to (system-independent)?
Upvotes: 2
Views: 289
Reputation: 67812
Why aren't you using a database? Use file-system database (like hsqldb) and an object relational mapping layer. You probably won't even need to write a mapping file of any kind, or arbitrarily make your classes serializable.
Store data in %APPDATA%/appName
on windows, and probably ~/.appName
on linux.
User/Library/Application/appName
could work on macs.
Upvotes: 2
Reputation: 61526
If you really don't want to store them in a data base take a look at the Preferences API it is platform neutral.
Upvotes: 2
Reputation: 13984
Most, if not all, OSes have a concept of a home directory where you end up having a lot of hidden configuration directories of one form or another. You could create a hidden directory under the users home directory and store your configuration/data files there.
Upvotes: 1