• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Storing Configuration Information

Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, so I've got an application that I can run via Java Web Start. This application works with a handful of files from the user's computer. However, these files may be in different locations on each person's computer. So, what I had done was created File Open dialogs so that the user could navigate to the file and open it directly.
However, this becomes a tedious process as the user is almost always accessing the same files and they almost never move.
I'd like to allow the user to select the locations for these file and then save them so that, the next time they launch the application, they can be loaded automatically or with the click of a single button (instead of forcing the user to navigate to the files via an Open File Dialog).
Please forgive my nieveness with this as this is pretty much all new ground for me. However, how can I store that information on the user's computer? All of my class files are coming from a JAR file and I can't write anything inside there, right?
Is the best way to do this just to create a file somewhere on their system (say the C:\ drive) and then check for that file on subsequent executions?
This would seem as if it would work, but I wonder if there is a better way (or a better place to put the file). Where does the application get cached when it is downloaded and executed? Could I put the file there?
Any ideas would be greatly appreciated.
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Corey,
well, even writing in c:\directory won't work as what will happen in case where users don't have write access to c:\directory and all stupid access things u know..
the better approach might be,
1. u keep a profile file yourself. u can look at the PersistenceAPI part of the JNLP api
2. what u would store in that profile file? following,
- a list of file paths selected previously by the user (the whole system file path)
- whenever user wants the file to be saved, u provide that list to him via an interface.
- if he wants to use any of the available filepaths then he can just select from the list OR if he wants another location then he should be able to popup a file dialog as do right now...
- that file dialog interface should save the lastest selected path in the profile list for future access u know..
am i clear enough? i've done something similar to this in my application. i had an application that was "signed" so i was having less troubles as i could read/write files in the system. my application was allowing user to select a HTML editor for editing a file and then lauch the selected HTML editor with the file to be edited.i was supposed to save the selected HTML editor for future so that next time user can just select from the list...my application enabled users to remove/add to that list and make some HTML editor default as well...
hope i'm little helpful here..
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic