Java examples for java.util:Properties File
get Application Properties
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class Main { public static void main(String[] argv) throws Exception { Class clazz = String.class; System.out.println(getApplicationProperties(clazz)); }/*from w w w . j a v a2 s . com*/ public static Properties getApplicationProperties(Class<?> clazz) throws IOException { Properties appProperties = new Properties(); InputStream in = null; try { in = clazz.getResourceAsStream("application.properties"); appProperties.load(in); return appProperties; } finally { if (in != null) { in.close(); } } } }