I tried to read a .properties file in Java and have the following code:
public final class Config {
static {
Properties properties = new Properties();
InputStream propertiesStream = Object.class.getResourceAsStream("config.properties");
if (propertiesStream != null) {
try {
properties.load(propertiesStream);
} catch (IOException e) {
e.printStackTrace();
}
} else {
System.out.println("file not found");
}
}
}
But it keeps saying file not found.
The content of properties is
pwd=passw0rd
Anyone knows how to solve this problem?