After adding a resource folder try this :
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream input = classLoader.getResourceAsStream("test.png");
try {
image = ImageIO.read(input);
} catch (IOException e) {
e.printStackTrace();
}