YangJXDream 2017-07-01 07:06 采纳率: 16.7%
浏览 1675

Java更改.properties文件

Properties prop = new Properties();

FileOutputStream oFile = new FileOutputStream("systemConfig.properties", true);
prop.setProperty("a", 1);
prop.store(oFile, "The New properties file");
oFile.close();

    这样子没修改成功!文件路径也没报错
  • 写回答

4条回答 默认 最新

  • 王威振的csdn 2017-07-01 08:21
    关注

    这样写试一下;

    Properties prop = new Properties();

    FileInputStream oFile = new FileInputStream("systemConfig.properties");
    prop.load(oFile);
    prop.setProperty("a", 1);
    prop.store(new FileOutputStream("systemConfig.properties"), "The New properties file");
    oFile.close();

    评论

报告相同问题?