I am creating a program that has to read an image from a folder inside the resource folder. At the moment I have just put all of the images in the resource folder however, having many images, this is not a viable approach. I am using the:
new ImageIcon(ImageIO.read(getClass().getResourceAsStream()
method and it works for reading directly from the resource folder but, when I put the pictures inside a folder, which is in the resource folder, it is not working...
How could I resolve this?
This worked in a small console test for me
-resources
-imagefolder
-image.png
ImageIcon icon = new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/imagefolder/image.png")));