import org.ini4j.Ini; import org.ini4j.Ini.Section; public class IniFileExample { public static void main(String[] args) { try { Ini ini = new Ini(new File("config.ini")); Section section = ini.get("database"); String host = section.get("host"); String port = section.get("port"); section.put("port", "3306"); Section newSection = ini.add("server"); newSection.put("name", "Tomcat"); newSection.put("port", "8080"); ini.store(); } catch (IOException e) { e.printStackTrace(); } } }


上一篇:
下一篇:
切换中文