import java.util.*; import java.io.*; public class PropertiesConfig { public void SaveConfig(String _option, String _value) { String filename, option = _option, value = _value; File file; Properties properties; InputStream input; OutputStream output; filename = "/tmp/LansinTVserver.config"; file = new File(filename); try { if(!file.exists()) { System.out.println(filename + " does not exist. Creating file."); file.createNewFile(); } properties = new Properties(); properties.load(input = new FileInputStream(file)); input.close(); properties.setProperty(option, value); //properties.remove(key); //properties.list(System.out); properties.store(output = new FileOutputStream(file), null); output.close(); } catch(IOException e) { e.printStackTrace(); } } }