Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

reading configuration file

Thread view: 
giangiammy@gmail.com - 06 Dec 2005 09:16 GMT
hi all,

I need to read some simple configuration parameters in my program.
Is there  some standard format/library/tecnique in java?
it would be a 10 line parsing function what I need, but if I can
use something already present it's better

thanks
giammy
IchBin - 06 Dec 2005 09:23 GMT
> hi all,
>
[quoted text clipped - 5 lines]
> thanks
> giammy

java.util.Properties

http://javaalmanac.com/egs/java.util/Props.html
http://javaalmanac.com/egs/java.util/GetSetProps.html
Signature


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

IchBin - 06 Dec 2005 09:32 GMT
>> hi all,
>>
[quoted text clipped - 10 lines]
> http://javaalmanac.com/egs/java.util/Props.html
> http://javaalmanac.com/egs/java.util/GetSetProps.html

http://java.sun.com/j2se/1.5.0/docs/api/index.html

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

amitkch@gmail.com - 06 Dec 2005 10:30 GMT
XML is one of the most popular way of storing configuration information
and the files can be parsed using JDOM (www.jdom.org) or any other XML
parser.

Amit :-)
Hiran Chaudhuri - 06 Dec 2005 21:40 GMT
> XML is one of the most popular way of storing configuration information
> and the files can be parsed using JDOM (www.jdom.org) or any other XML
> parser.

What's wrong with Properties?
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#loadFromXML(ja
va.io.InputStream
)

Hiran
IchBin - 06 Dec 2005 22:52 GMT
>> XML is one of the most popular way of storing configuration information
>> and the files can be parsed using JDOM (www.jdom.org) or any other XML
[quoted text clipped - 4 lines]
>
> Hiran

I suggested java.util.Properties this early this morning.

Stephane had suggested java.util.prefs.Preferences

http://java.sun.com/developer/technicalArticles/releases/preferences/

This seems to use the registry for windows. I have never used it. I want
to look closer at this for myself.

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Thomas Weidenfeller - 07 Dec 2005 08:56 GMT
> XML is one of the most popular way of storing configuration information
> and the files can be parsed using JDOM (www.jdom.org) or any other XML
> parser.

XML is almost the most stupid format for simple configuration data. Non
intuitive, difficult to edit by hand without a special XML editor, wordy
syntax which is easy to type wrong, difficult to parse ("visually" by a
human when looking for errors, and also by a machine and by
line-oriented text processing tools), etc.

And the only advantage of XML, to be - at least in theory - shareable
between applications who have never heard about each other before,
doesn't apply here.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Viator - 07 Dec 2005 09:52 GMT
Most stupid things are often more popular and simple. Although,
properties and prefs are not that bad at all if you have only Java in
your mind.

Amit :-)
Stephane - 06 Dec 2005 12:05 GMT
giangiammy@gmail.com a écrit :
> hi all,
>
[quoted text clipped - 5 lines]
> thanks
> giammy

java.util.prefs.Preferences

http://java.sun.com/developer/technicalArticles/releases/preferences/
Malte - 06 Dec 2005 15:02 GMT
> hi all,
>
[quoted text clipped - 5 lines]
> thanks
> giammy

web.xml if it is a web app.
Roedy Green - 06 Dec 2005 20:49 GMT
On 6 Dec 2005 01:16:00 -0800, "giangiammy@gmail.com"
<giangiammy@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>I need to read some simple configuration parameters in my program.

see http://mindprod.com/jgloss/properties.html
http://mindprod.com/jgloss/preferences.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.