Storing a file in the user's directory in cross-platform Java

Posted by dalyons on Stack Overflow See other posts from Stack Overflow or by dalyons
Published on 2009-10-15T07:19:34Z Indexed on 2010/04/27 3:53 UTC
Read the original article Hit count: 260

Filed under:
|
|

I have a Java application that runs on Mac and Windows, directly off a CD/DVD with no installation. Now, I need to store a file containing per-user data (think favourites etc.) somewhere on the local file system, so that it can be written to.

So, where do you think is a good location for this file? I am thinking something like:

<USER_DOCUMENTS_AND_SETTINGS>/application data/myapp/favourites.db for windows <USER_HOME_DIR>/.myapp/favourites.db for mac/nix

Thoughts? And does anyone know the best way to determine these paths within Java?

© Stack Overflow or respective owner

Related posts about java

Related posts about cross-platform