Question: I have a SWT Java app that runs on Windows XP / Vista / 7 and Mac OS X. I'm currently saving a config file to:

System.getProperty("user.home") + filename

With the changes in security in Windows Vista and Windows 7 this doesn't seem to be the best place to save it anymore.

This file saves information such as registration key info and it is annoying for my users if the file can't be saved or is deleted.

Is there a better path I should use?

Also, what's the preferred path for per user application data on Mac OS X?

Answer: 
macos path for application data to be kept is "~/Library/Application Support" as per [Apple documentation](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW1)
Sun itself, with its java control panel, had the very same problem ([bug 6487334)](http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6487334): their control panel, running at different integrity level, could not both read/write to their deployment directories.

They moved it to `c:\users\<username>\appdata\local`, but had to not rely on `System.getProperty("user.home")` because to this day, it uses a registry KEY that can be set to incorrect value if windows is "tweaked": [bug 6519127](http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6519127)

So the question [How to get local application data folder in Java?](https://stackoverflow.com/questions/1198911/how-to-get-local-application-data-folder-in-java), using `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\*` is the right place to start looking for read/write access for your settings.  

You can read it with, for instance, [SWT Win32 Extension](http://feeling.sourceforge.net/) project.

The interest to keep your data within the user's homedir is that they will be part of the user's profile which can be a [*roaming* profile](http://blogs.msdn.com/oldnewthing/archive/2005/06/30/434209.aspx), saved at logoff and restored at logon (used quite often on corporation's workstations)