Loads a property file located anywhere in the classpath
1
2 private Properties getPropertiesFromClasspath(String propFileName) throws IOException {
3 // loading xmlProfileGen.properties from the classpath
4 Properties props = new Properties();
5 InputStream inputStream = this.getClass().getClassLoader()
6 .getResourceAsStream(propFileName);
7
8 if (inputStream == null) {
9 throw new FileNotFoundException("property file '" + propFileName
10 + "' not found in the classpath");
11 }
12
13 props.load(inputStream);
14
15 return props;
16 }