Reading an INI File in JAVA

I tried to get values ​​from an INI file, and I am writing code in Java. So far I read about this function and yes, it returns values ​​from the INI file.

String property = properties.getProperty("property.name");

But this is the code I need.

Is there a function in Java equivalent to GetPrivateProfileString from C?

+4
source share
1 answer

No, there is no native support for initializing .INI files in Java.

Java uses property files that lay out their data like this:

propertyOne = 1
propertyTwo = 2

C uses initialization files (.INI), which output their data into sections:

[Section]
propertyOne = 1
propertyTwo = 2

In Java, properties do not have “partitions”, but can be partitioned by the same convention for naming packages:

section.propertyOne = 1
section.propertyTwo = 2

, properties.getProperty("section.propertyOne");, INI , .

INI , . API- Java INI ini4j.

http://ini4j.sourceforge.net/

, .INI , Windows. .INI , Java - .

+9

All Articles