Java - Properties
Properties properties = new Properties();
properties.load(new FileInputStream(new File(fileName)));
String server = properties.getProperty("PROPERTY_NAME");
How to read a .properties file?
private Properties getAdminProperties(String fileName) throws Exception {
Properties properties = new Properties();
properties.load(new FileInputStream(new File(fileName)));
//properties.load(FileFinder.getResourceAsStream(fileName));
return properties;
}
How to access a particular property from a Properties object?
Properties ap = getAdminProperties(cs.getRealPath("plugins\\CustomTask\\WEB-INF\\classes\\adminCredential.properties"));
server = ap.getProperty("ISERVER");
page revision: 3, last edited: 31 Oct 2016 01:21