import java.io.IOException; import java.io.InputStreamReader; import java.util.Properties; public class ReadPropertiesSample { private static Properties configuration = new Properties(); private static String path = "PropertiesSample.properties"; static { try{ InputStreamReader cf = new InputStreamReader( ReadPropertiesSample.class.getResourceAsStream(path), "UTF-8" ) ; configuration.load(cf); cf.close(); } catch(IOException e){ System.out.println(e.getStackTrace()); } } public static void main(String[] args) { System.out.printf("%s=[%s]\n", "caption",configuration.getProperty("caption")); System.out.printf("%s=[%s]\n", "comment",configuration.getProperty("comment")); } }