Use the below code to read the java property file and retrieve the property value.
Properties properties = new Properties();
FileInputStream in;
try {
in = new FileInputStream("app.properties");
properties.load(in);
in.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
return properties.getProperty("appcode");
Sample "app.properties" file is shown below.
appcode=50
email=admin@yahoo.com
No comments:
Post a Comment