Here you can find the source of loadProperties(String fileName, Properties properties)
static public void loadProperties(String fileName, Properties properties)
//package com.java2s; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; public class Main { private static String fUserHome = System.getProperty("user.home"); private static char fFileSeparator = System.getProperty("file.separator").charAt(0); private static char fLastCharOfDirectory = fUserHome.charAt(fUserHome.length() - 1); static public void loadProperties(String fileName, Properties properties) { try {//from w ww.j a v a 2 s . c om FileInputStream fis = new FileInputStream(makeFullPathname(fileName)); BufferedInputStream bis = new BufferedInputStream(fis); properties.load(bis); bis.close(); fis.close(); } catch (FileNotFoundException e) { // Do nothing. Data file will be created eventaully. } catch (IOException e) { e.printStackTrace(); } } static public String makeFullPathname(String fileName) { if (fLastCharOfDirectory == fFileSeparator) return fUserHome + fileName; else return fUserHome + fFileSeparator + fileName; } }