1、依赖jar包
ini4j-0.5.4.jar
2、官网
3、测试例子
package cn.yjx.ini4j;
import java.io.File;
import java.io.IOException;
import org.ini4j.Wini;
public class Ini4jTest {
public static void main(String[] args) throws IOException {
test1();
}
public static void test1() throws IOException {
String fileName = "D:\\dev\\Java\\MyEclipse_workspace\\Test\\src\\cn\\yjx\\ini\\test1.ini";
Wini ini = new Wini(new File(fileName));
int age = ini.get("happy", "age", int.class);
double height = ini.get("happy", "height", double.class);
String dir = ini.get("happy", "homeDir");
System.out.println(age);
System.out.println(height);
System.out.println(dir);
}
}
被操作文件:
[happy]
age = 99
height = 77.66
homeDir = /home/happy