> I'm also having problems with where I locate the properties files. At
> present it/they sit in the top level of my classes dir, accessed like
[quoted text clipped - 6 lines]
> change the property settings. What if the user wants to override
> settings - does this have to be from the command line?
> > I'm also having problems with where I locate the properties files.
...
> I'd keep the default properties there but allow users to save settings
> to a properties file located in their home directory.
Good call. To help prevent the possibility of our program's
settings overriding the settings of another program, it is also
a good idea to pop settings into a *sub* directory of user.home,
based on the reverse package name of the main() class
(and no 'default package' app.s here, please!).
Andrew T.
Wardie - 08 Nov 2006 09:46 GMT
(Thanks for all the replies folks)
> ... To help prevent the possibility of our program's
> settings overriding the settings of another program, it is also
> a good idea to pop settings into a *sub* directory of user.home,
> based on the reverse package name of the main() class
> (and no 'default package' app.s here, please!).
I had thought about the default properties being in the .properties
file that "ships" with the classes/HAR file. Glad I wasn't going wrong
there.
The use of user.home as the location I find interesting. I've not
really made much use of prroperties up to this point. My Java work has
mainly been based around Tomcat/Servlets and a big slab of "business
objects" that all end up withing the WEB-INF/classes dir thereof. This
meant the I found there were already several places to stick my
settings. Now, however, I am doing a few Swing apps and a few
standalone/command line utils and this means I have to separate things
out from the "Big Ball of Mud" I had in the Tomcat world.
I was struggling to think of a common place for user properties to be
stored, I was thinking of a /properties or /config or even /xml dir at
the same level as the users /classes because I was assuming "users"
would be using the components as part of their own devleopment
projects. Obviously this is a blinkered view. Some will just want to
execute applications - and thus will not have a suitable dir structure.
So user.home seems a good place.
Hmmm - this is what comes of being a lone-Java jokey in a small
company. All the "users" I have at present are web-based or use a
WebStart invoked Swing app that currnetly has no property/configuration
support.
Thanks again,
Chris