W
Wardie
Hi all,
I have been searching around the archives but can't find an easily
digestible answer to my (simple) question.
Question : I'm using Java 5.0, what's the best way to set properties in
my code?
I currently use basic Java Properties, but I'm not sure that's the best
route these days. It certainly works - but I'd like to have macro
substitutions, along the lines of
myBase = C:/base
myApp = $myBase/bin/myAppName
which I know I can get from various thirdparty implementations.
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
this ...
URL propertiesFileUrl = MyMainClass.class.getClassLoader().
getResource(filename);
.... but if I packed that up as a JAR it makes it hard for people to
change the property settings. What if the user wants to override
settings - does this have to be from the command line?
I've reasd about the Preference API but don't know if that's the
answer.
Sigh.
Any opinions on this would be apprecaited - I don't want to start a
religious war on the topic though )
Many thanks,
Chris
I have been searching around the archives but can't find an easily
digestible answer to my (simple) question.
Question : I'm using Java 5.0, what's the best way to set properties in
my code?
I currently use basic Java Properties, but I'm not sure that's the best
route these days. It certainly works - but I'd like to have macro
substitutions, along the lines of
myBase = C:/base
myApp = $myBase/bin/myAppName
which I know I can get from various thirdparty implementations.
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
this ...
URL propertiesFileUrl = MyMainClass.class.getClassLoader().
getResource(filename);
.... but if I packed that up as a JAR it makes it hard for people to
change the property settings. What if the user wants to override
settings - does this have to be from the command line?
I've reasd about the Preference API but don't know if that's the
answer.
Sigh.
Any opinions on this would be apprecaited - I don't want to start a
religious war on the topic though )
Many thanks,
Chris