Here you can find the source of saveProperties(Properties properties, String name)
public static void saveProperties(Properties properties, String name)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.URL; import java.net.URLDecoder; import java.util.Properties; public class Main { public static void saveProperties(Properties properties, String name) { try {/*from w w w .j a va 2 s. co m*/ // Use -Drepox.data.dir= in the VM parameters in order to pass an already existing configuration.properties and gui.properties String configsDataDir = System.getProperty("repox.data.dir"); String configurationFile; if (configDataDirAlreadyExists(configsDataDir, name)) configurationFile = URLDecoder.decode(configsDataDir + File.separator + name, "ISO-8859-1"); else { URL configurationURL = Thread.currentThread().getContextClassLoader().getResource(name); configurationFile = URLDecoder.decode(configurationURL.getFile(), "ISO-8859-1"); } properties.store(new FileOutputStream(configurationFile), null); } catch (IOException e) { e.printStackTrace(); } } public static boolean configDataDirAlreadyExists(String configsDataDir, String configurationFilename) { if (configsDataDir == null || configsDataDir.isEmpty()) return false; File configFile = new File(configsDataDir + File.separator + configurationFilename); if (!configFile.exists()) { System.out.println("Load Config files from Java Variables -- " + configurationFilename + " file doesn't exist on the specified directory"); return false; } return true; } }