The following code grants me access to a specific PNG resource within my project:
BufferedImage temp = ImageIO.read(Thread.currentThread().getContextClassLoader().getResource("play.png"));
However, I have n images that I don't have to have to hardcode ("play.png", "pause.png", etc); without having an external image library (which I would simply loop through with File
), is there a way to get all images within the project?
Ideally, all files within a specific source folder, really. Or source folders. getResources
only seems to work for multiples of a specific named resource, which isn't what I want.
EDIT:
To be clear, this is a local project / application; it isn't intended to be a servlet or otherwise deployed on the Web. Question updated with the offline
tag in case this is applicable.