Updating property value in properties file without deleting other values [duplicate]

Open the output stream and store properties after you have closed the input stream.

try (FileInputStream in = new FileInputStream("First.properties")) {
    Properties props = new Properties();
    props.load(in);
}
        
try (FileOutputStream out = new FileOutputStream("First.properties"))
    props.setProperty("country", "america");
    props.store(out, null);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)