The World’s Largest Online Community for Developers
I have a problem regarding the ImageIO.read() function:
URL imageURL = this.getClass().getResource(sheetPath); spriteSheet = ImageIO.read(imageURL);
The ImageIO function returns null even though the URL is correct (it leads to a .png file). I've tried to put the getResource() as a parameter for the read function, but that didn't work either. Has anyone encountered a similar problem and maybe found a solution?
sheetPath is "/images/pizzaGirl.png"
imageURL is "file:/Users/Kevin/Dropbox/workspace/PizzaGirl/bin/images/pizzaGirl.png"
images is in the "res" folder which I added to the classpath via the eclipse's run configurations
Okay I tried to replace my path with a different image and it worked. I went back into photoshop, exported my image again and voilà, it works.
Check if the path is really correct. To do this write:
then if it returns false please post the path. I will check if it is correct.