Error thrown--
Exception in thread "Thread-3" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(Unknown Source)
Code--
try {
playerImage = ImageIO.read(Player.class
.getResourceAsStream("/toon.png"));
} catch (IOException e) {
e.printStackTrace();
}
File path--
H:\workspace\Isaac\resources\toon.png
Ive researched this a bit but none of the solutions have really worked for me. any ideas?
If
Isaacis your project folder, then the way your are reading should work. Please check whether the directoryresourcesis a source folder (in eclipse it should have an icon of a folder with an overlay of a java package), if not then right click on it and got toBuild pathand chooseUse as Source Folder.Your directory structure should look something like this:
before compiling
after compiling
getResourceAsStreamlooks for the image inbinand not in the one inresources