Here you can find the source of saveProperty(String key, String value)
public static void saveProperty(String key, String value) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Properties; public class Main { private static final String FILE_NAME = "config.properties"; private static Properties mProperties; public static void saveProperty(String key, String value) throws IOException { if (mProperties == null) mProperties = new Properties(); createFile();/*from w w w . jav a 2 s . co m*/ try (OutputStream lOutputStream = new FileOutputStream(FILE_NAME)) { mProperties.put(key, value); mProperties.store(lOutputStream, null); } catch (IOException e) { throw e; } } private static void createFile() throws IOException { File lFile = new File(FILE_NAME); if (!lFile.exists()) { lFile.getParentFile().mkdirs(); lFile.createNewFile(); } } }