google Analytics

Wednesday, July 14, 2010

loading a properties file Currently Being Moderated PropertiesFromDeploymentFile

PropertiesFromDeploymentFile


Here is some sample code for loading a properties file in the META-INF directory of a deployment file.

public Properties getPropAsResource(String name) throws Exception

{

InputStream is = getClass().getResourceAsStream("/META-INF/" + name);

if (is == null)

{

throw new Exception("Unable to locate resource: " + name);

}

Properties confProp = new Properties();

confProp.load(is);

return confProp;

}}}


No comments:

Post a Comment