On 5/21/07, vikas rao <[EMAIL PROTECTED]> wrote:
Can you give me an example?
The reason I chose to do it this way is basically I can change the
inputDirectory, outputdirectory and other values without making any changes in the code, hence using it anywhere becomes easy. In our company, we have a jar file which is included in the build path and then we access the config files like: Config configRoot = ConfigFactory.create(ConfigFactory.DEFAULT); and then using the Config object, go onto access the values in the .cfg files...but If i want to use this elsewhere, how would i do a similar thing?
As long as your jar file and the cfg file are under the same classpath, it shouldn't be any problem to read the value. That was my question.
Thanks. Vikas. On 5/21/07, MK Tan <[EMAIL PROTECTED]> wrote: > > Hi, > > Just wonder why you need to do this in xml way? > Wasn't it much simpler if you do it in properties (key value) format? > Most of the time, I just found it people like to overuse xml :-p > > Best regards, > MK Tan > > On 5/21/07, vikas rao <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > Can someone point out a tutorial or some place where I can learn how to > > read > > values from a .cfg file? > > Say I have a Input.cfg file which goes like: > > <com> > > <MyCompany> > > <Common > > inputDir="C:/vray/xml_files/" > > outputDir="C:/xm_output" > > /> > > </MyCompany> > > </com> > > > > Now, if I need the inputDir value inside my program, how do I do it? > > > > Sorry that this is off topic from struts, but i cant seem to find some > > sensible help. > > > > Any help will be appreciated. > > Thanks. > > Vikas. > > >