For configuration preferences, there is the Java Preferences API.
For other files, I have not found a solution to this. The best solution, at present, is probably to dispatch on the OS type with a fallback based on the user.home
property.
On Linux/Unix (not Mac), you might want to honor the XDG Base Directory specification.