В принципе, я должен перезаписать определенное свойство в файле .properties через приложение Java, но когда я использую Properties.setProperty() и Properties.Store(), он перезаписывает весь файл, а не только одно свойство.
Я попытался построить FileOutputStream с append = true, но с этим он добавляет другое свойство и не удаляет/не перезаписывает существующее свойство.
Как я могу его закодировать так, чтобы установка одного свойства перезаписывала это конкретное свойство без перезаписи всего файла?
Изменить: я попытался прочитать файл и добавить его. Здесь мой обновленный код:
FileOutputStream out = new FileOutputStream("file.properties");
FileInputStream in = new FileInputStream("file.properties");
Properties props = new Properties();
props.load(in);
in.close();
props.setProperty("somekey", "somevalue");
props.store(out, null);
out.close();