This is the code what i have written. but when i am trying to print key and value its getting null pointer.
My main concern is to load the keys and values from the property files and need to store in a map
Map<String, String> prop1 = new HashMap<String, String>();
Map<String, String> prop2 = new HashMap<String, String>();
public static void main(String args[]) {
Sample sample = new Sample();
sample.getLocaleOne();
}
public void getLocaleOne() {
Properties prop = new Properties();
InputStream input = null;
try {
File file = new File("Labels.properties");
System.out.println("file.getAbsolutePath());
input = this.getClass().getClassLoader().getResourceAsStream("C:/workspaceNewI18NChnages/customer/Labels.properties");
prop.load(input);
Enumertion<?> e = prop.propertyNames();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String value = prop.getProperty(key);
System.out.println("Key : " + key + ", Value : " + value);
}
} catch (Exception e) {
e.printStackTrace();
}
}