Read .property file Using JAVA

Properties prop = new Properties();
InputStream input = null;
String username = null;
try {
//You should create 'kflsys.properties' file in C drive.
input = new FileInputStream("C:/kflsys.properties");
// load a properties file
prop.load(input);
username = prop.getProperty("username");
// get the property value and print it out
log.info("USERNAME:" + username);

} catch (Exception e) {
e.printStackTrace();
}

Post a Comment

Previous Post Next Post