Here you can find the source of loadProperties()
private static void loadProperties() throws FileNotFoundException, IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.FileNotFoundException; import java.io.FileInputStream; import java.io.File; import java.util.Properties; import java.util.Enumeration; public class Main { private static Properties m_properties = new Properties(); private static String m_propFilePath = new String("~"); private static String m_propFileName = new String("~"); /******************************************************************************** ** Private methods//from w ww .j a v a2s . com *********************************************************************************/ private static void loadProperties() throws FileNotFoundException, IOException { //refresh properties m_properties = new Properties(); try { loadProperties(m_properties, new File(m_propFilePath, m_propFileName)); } catch (FileNotFoundException e) { throw e; } catch (IOException e) { throw e; } } /******************************************************************************** ** Read from the given file and fill keys in the given property hashtable *********************************************************************************/ private static void loadProperties(Properties theProperties, File theFile) throws FileNotFoundException, IOException { FileInputStream stream = null; try { stream = new FileInputStream(theFile); } catch (FileNotFoundException e) { throw e; } try { theProperties.load(stream); } catch (IOException e) { throw e; } finally { try { if (stream != null) stream.close(); // Make sure the stream is closed promptly... } catch (IOException e) { // do nothing... } } // Remove any leading/trailing blanks from the property values Enumeration e = theProperties.propertyNames(); while (e.hasMoreElements()) { Object o = e.nextElement(); String key = (String) o; String val = theProperties.getProperty(key); String trimmedVal = val.trim(); if (!val.equals(trimmedVal)) { theProperties.put(key, trimmedVal); } } } }