views:

207

answers:

3

For Java Web Start is there a default place to store and access data related to my program? Or do I need to create a folder? For Java Web Start (assuming I don't get a program folder) is it standard to just create on in Program Files for window, Applications for mac, etc?

A: 

There is no specific default place to store and access data related to your program with webstart. However Java does have the Preferences API to provide a platform independant way of storing configuration without worrying about the specific storage location/format.

Mark
Ok thanks, so if I wanted to store say an sqlite db, I'd basically just try to conform to the practices of the system for creating the program folder?
random dude
If you wanted to use a sqlite db I would say that best practice would be to store it under the user directory.
Mark
A: 

In addition to the Preferences API for storing user settings there are a few services that can be found in the javax.jnlp package.

For your concrete requirement the PersistenceService would be particularly useful.

Alternatively you can simply provide all data that your application requires as part of your .jar files, reference them in your .jnlp file and customize how and when they are downloaded by using the DownloadService.

Joachim Sauer
+1  A: 

I would use a subdirectory in the users home directory. E.g. System.getProperty("user.home") + File.separator + ".myapp/"

But for that the user has to add extra permissions for the a web start application.

To persist you can use a properties file or XmlEncoder which are included in the JDK. Or use external libraries like XStream, Xvantage or the simple framework where it is simple as

xstream.save(anyObject)
Karussell