standard way to reda ini files?

L

lallous

Hello,

Is there is a standard way to read INI (Windows' ini files) from Java?

Or I have to write my own parser?
 
H

Harald Hein

lallous said:
Hello,

Is there is a standard way to read INI (Windows' ini files) from
Java?

Or I have to write my own parser?

Google for existing free parsers.
 
P

P.Hill

Harald said:
:




Google for existing free parsers.

If you just want to read

Tag= value
# this is a comment
tag2=value ...

then use Property.load()

props = new Properties();
props.load( inputStream );

HTH,
-Paul
 
H

Harald Hein

P.Hill said:
If you just want to read

Tag= value
# this is a comment
tag2=value ...

Which will not help him reading Windows INI files, which have these
nasty sections, which are not understood by Properties. But there are
hundrests of Java INI parsers out there. Google comes up with a few
thousand hits.
 
L

lallous

Hello Paul,

It is okay w/ Property class then because I will be writing the INI like
file and I will avoid using sections.

I am a newbie in Java and never used that class, but isn't this class
supposed to store any classes so would the file format still be as:
key=value
Even if I set other than String class properties?
 
P

P.Hill

lallous said:
Hello Paul,

It is okay w/ Property class then because I will be writing the INI like
file and I will avoid using sections.

Great, then you are set.
I am a newbie in Java and never used that class, but isn't this class
supposed to store any classes

No, not at all. setProperty only takes a String value and String tag.

Merry Christmas, Happy Chanukah, a good Boxing Day to you.
-Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top