Here you can find the source of saveProperty(String key, String value)
private static void saveProperty(String key, String value)
//package com.java2s; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Properties; public class Main { private static void saveProperty(String key, String value) { Properties properties = loadUserSettings(); properties.setProperty(key, value); saveUserSettings(properties);//from w w w . ja v a 2 s . c o m } private static Properties loadUserSettings() { String filename = System.getProperty("user.home") + File.separator + ".RacePoint.xml"; Properties result = new Properties(); InputStream in = null; try { in = new FileInputStream(filename); BufferedInputStream inBuf = new BufferedInputStream(in); result.loadFromXML(inBuf); inBuf.close(); } catch (IOException e) { result = new Properties(); } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } } return result; } private static void saveUserSettings(Properties properties) { String filename = System.getProperty("user.home") + File.separator + ".RacePoint.xml"; OutputStream out = null; try { out = new FileOutputStream(filename); BufferedOutputStream outBuf = new BufferedOutputStream(out); properties.storeToXML(outBuf, "User settings for RacePoint"); outBuf.close(); } catch (IOException e) { } finally { if (out != null) { try { out.close(); } catch (IOException e) { } } } } }