2

Can we allow user to set and save application data and temp data using Java-Application that has beenrun/launch using JWS ? Does it make sense ?

We would like to know if user run JNLP directly then can user save preferences settings on local so when he/she run again JNLP he/she could find his/her last saved settings again.

Where to put application data i.e configuration files, properties file. user download path etc.. and where to put temp files i.e.. logs etc.. on Windows, Linux and MAC if java-application is being launched using JWS ?

Ashish Pancholi
  • 4,569
  • 13
  • 50
  • 88

1 Answers1

4

I often use java.util.prefs.Preferences, but javax.jnlp.PersistenceService is available to Java Web Start applications. Both represent abstractions that are cross-platform.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • 3
    Using `Preferences` requires the JWS application to be signed, but using `PersistenceService` does not. – finnw Dec 05 '11 at 20:06
  • 1
    See also this [example and code](http://pscode.org/jws/api.html#ps) for the `PersistenceService`. Note that it is only designed for relatively small amounts of data, I would not rely on it after about 16Kb. – Andrew Thompson Dec 06 '11 at 01:23
  • @ trashgod & @ Andrew I am really sorry I am not getting your suggestion. If I say in terms of my Java desktop application that creates some configuration files (that stores information like user setting, page size, credentials etc.) at %APPDATA% and creates logs at %TEMP% location. So where I supposed to create configuration files and logs file if application is being launch using JWS. – Ashish Pancholi Dec 12 '11 at 06:05
  • 1
    @AshishPancholi: This [example](http://robotchase.sourceforge.net/) uses `Preferences`, and Andrew's [example](http://pscode.org/jws/api.html#ps) demonstrates a `PersistenceService`. Using paths from environment variables is possible, but it's not cross-platform. – trashgod Dec 12 '11 at 07:40
  • @trashgod Thanks.. I have been using %APPDATA% and %TEMP% for My java desktop application on MAC and Linux O.S. and they are working absolute fine. – Ashish Pancholi Dec 13 '11 at 04:56
  • @AshishPancholi: Ah, I see the [congruence](http://en.wikipedia.org/wiki/Environment_variable#Synopsis) via the `user.home` and `java.io.tmpdir` properties; thank you. – trashgod Dec 13 '11 at 11:17