This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
My application deployed through Web Start creates a bunch of files that need to be accessed across invocations of the application (i.e. they are not deleted when the application shuts down).
I have a question related to where these files should be stored:
1) Is there any recommended location specific to Web Start? 2) If not, which system property should I look at, knowing that the application should be cross-platform? Or is there another way to find a suitable location?
The quick-and-dirty answer is to create a subdirectory in the user's home directory and store your dirty secrets there.
You could take advantage of the separate Windows and Unix conventions of putting data in "Application Data" and in files beginning with ".". If the directory "Application Data" exists, you know you are on Windows. (But I doubt this works in non-English-speaking environments.)
A more transparent solution is to ask the user where to store files. The first time the program runs, it checks to see if the user has picked a location to store files. You can do this with the Preferences API. If that directory has been defined, and exists, use it. Otherwise ask the user where to put your files and remember that location with the Preferences API.
Wherever you put the directory, I recommend that you let the user know where that directory is. For example, if you have a "Help->About" menu item, that could give information about where this directory is at, and might give the user a chance to move this directory and/or clear the contents.