I have a mvn project, I have the config.properties in the resources and I want to call it in the main
public class GetProperties {
private Properties prop = new Properties();
public GetProperties() {
InputStream in =
getClass().getResourceAsStream("/config.properties");
try {
prop.load(in);
} catch (FileNotFoundException e) {
System.out.println("The property file was not found");
} catch (IOException e) {
System.out.println("Can not read property file");
}
}
public String getPropValues( String propertyName){
return prop.getProperty(propertyName);
}
}
That's my GetProperties class, but it gives me Null Pointer Exception