I am working on a Java Desktop program which upon its installation will designate a default database directory and working directory. Where should I save such information so that the next time the user open the program, the program knows where to look for database and working directory?
Things that come to mind:
- store everything in the registry (well, did that in MATLAB version and if there is another way, definitely will not go there).
- set up another database attached in the jar file to store everything
- Is this a so called persistence problem? What are Java Persistence or Java Data Object? Do they have the way to make it working?
- any other suggestions?
Take a look at the Java Preferences API. It is a standard Java SE mechanism for storing preferences that does so in a platform specific, but application neutral way. Uses the Registry on Windows, Preferences files on OS X, and I believe ~/.files on Unix.