Chris Berg said:
You are right about that - you don't.
Which is why I replied in the form of a question, orginally. I don't presume
to know your reasoning and now I do.
(We are changing the subject radically now, but what the heck - it's
still interesting).
There can be many reasons for choosing a particular
design/layout/install procedure. In this particular case, it _does_
make sense to do it my way, for various reasons:
1) It is a server application, not your everyday GUI application. It
runs without any user intervention, with no user logged-in.
Then I'm not sure I see your reluctance to the command line parameter
option. Some script somewhere is going to have to kick off the server in the
boot process and adding a command line parameter (at least as an option)
seems to be a good way to go.
Assuming that your user can put the file where the jars are installed would
be bad practice. I can see that as a fallback. I think you should really
have several options.
2) The exact same app shall be installable on any platform that has a
Java VM (even on a Mac, for that matter). Thus, I cannot assume
anything about the presense of user/system repositories such as the
Windows Registry or Linux shared directory. I know Sun has made the
java.util.prefs package for this purpose, but that is, at the present
stage, only a framework which has to be implemented for the particular
platform. I'll wait and see what becomes of it.
It already became. Implementations are provided for different OS's. The
windows one uses the registry. The linux one stored it in files. Not sure
what the Mac one does.
This may or may not be viable for your scenario. In this case instead of
editing a file the user would use a GUI that you provide (either as a
separate application or integrated into your app) to edit the configuration
which is then persisted with the Preferences API.
3) Having the setup assembled in a single text file gives me the
advantage that I don't have to write an editor program for the
settings, the installer simply edits the settings file using a text
editor. Of course, she must study the installation manual to do that,
but what do I care?
An acceptable solution for a server app.
4 This approach makes it extremely simple to move the app to another
disk/cpu/system/platform.
Actually, it may hamper it. Once again I think it is wrong to assume that
placing code and user data in the same place is good practice. What if the
user wants several servers and all of them get the code from the same share
on the network. There is no reason to unnecessarily force them to have
separate copies of the source just for the purpose of finding the
configuration for that server.