I'm attempting to load an Image (leftStanding.png) using the following line:
spriteLeft[0] = new ImageIcon(getClass().getResource("resources/images/characters/" + characterType + "/leftStanding.png")).getImage();
where characterType
is (at the moment) "mainCharacterMale"
. However, I'm getting a NullPointerException at that line. Using Netbeans, the file path for the image is ProjectFolder/src/resources/images/characters/mainCharacterMale/leftStanding.png
. Oddly enough, earlier in the program I load a text file in a very similar fashion, with the path to that being ProjectFolder/src/resources/saveData/SaveFile1.txt
, and there's no errors with that. Any help would be appreciated.