Java tutorial
//package com.java2s; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class Main { public static String getProperty(String path, String key) { Properties prop = new Properties(); InputStream input = null; String output = ""; try { input = new FileInputStream(path); prop.load(input); output = prop.getProperty(key, ""); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return output; } }