6

Given a file containing this:

[upper]
a = A
b = B

[words]
1 = one
2 = two

How do I access these key/values with reference to their headers? Java's Properties() class only handles section-less files.

tshepang
  • 12,111
  • 21
  • 91
  • 136
  • 5
    Duplciate of [How to parse INI in Java](http://stackoverflow.com/questions/190629/what-is-the-easiest-way-to-parse-an-ini-file-in-java) – rds Dec 05 '11 at 15:43

2 Answers2

7

Use the ini4j library (tutorial linked): http://ini4j.sourceforge.net/tutorial/

Chris Dennett
  • 22,412
  • 8
  • 58
  • 84
4

If you are a fan of the Apache Commons offerings, they have a library just for you: Commons Configuration. Commons Configuration reads many more formats other than just the .INI style files.

ssahmed555
  • 442
  • 6
  • 16