In my class there is a static code block, and in src folder there is a propertie file so I use below code to read it.
static
{
InputStream iStream = null;
try {
iStream = this.getClass().getClassLoader()
.getResourceAsStream("config.properties");
if(iStream == null){
throw new IOException("File not found");
}
properties.load(iStream);
} catch (IOException e) {
e.printStackTrace();
}
}
then there is error "Cannot use this in a static context". So how to fix it? Thx