We have a connection pooling component (JAR file) for one of our application. As of now the application connection details are bundled with-in the JAR file (in .proper
public static String getPropertiesValue(String propValue) {
Properties props = new Properties();
fileType = PCLLoaderLQIOrder.class.getClassLoader().getResourceAsStream(propFileName);
if (fileType != null) {
try {
props.load(fileType);
} catch (IOException e) {
logger.error(e);
}
} else {
try {
throw new FileNotFoundException("Property file" + propFileName + " not found in the class path");
} catch (FileNotFoundException e) {
logger.error(e);
}
}
String propertiesValue = props.getProperty(propValue);
return propertiesValue;
}
above methods works for me, just store your property file into directory from where to run your jar and provide that name in place of propFileName, when you want any value from property just call getPropertyValue("name").