Here you can find the source of saveProperties(Properties p, String file)
public static void saveProperties(Properties p, String file)
//package com.java2s; /*// w w w .j ava 2s. c om * Copyright 2010 Nick Powers. * This file is part of WSExplorer. * * WSExplorer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * WSExplorer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with WSExplorer. If not, see <http://www.gnu.org/licenses/>. */ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; public class Main { public static void saveProperties(Properties p, String file) { FileOutputStream fos = null; try { fos = new FileOutputStream(new File(file)); p.store(fos, "User saved"); } catch (Exception e) { e.printStackTrace(); } if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); // ignore } } } }