Exception in thread "Thread-0" java.lang.IllegalArgumentException: input == null

Exception in thread “Thread-0” java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1388)
at com.townrpg.core.gfx.ImageLoader.load(ImageLoader.java:11)
at com.townrpg.core.Game.init(Game.java:47)
at com.townrpg.core.Game.run(Game.java:86)
at java.lang.Thread.run(Thread.java:745)

Source Code: https://github.com/MastaKillaGamer/TownRPG

After i fixed up my ImageLoader, SpriteSheet, and Tile Classes ive been getting this Error and i cant seem to find the root of the issue, may the java game dev gods come and assist me please :smiley: .

Game.java: 47: [icode]BufferedImage charSheet = loader.load(“textures/chars.png”);[/icode]
ImageLoader.java: 11: [icode]BufferedImage temp = ImageIO.read(getClass().getResource(path));[/icode]

getClass().getResource(path) is null, which means the resource "textures/chars.png" is not being found.

I suggest using Riven’s tool: http://www.java-gaming.org/topics/faq-cannot-find-the-resource-file/33226/msg/311678/view.html

Here is the results: http://pastebin.java-gaming.org/1705823334c1c
And here is the new Game class: http://pastebin.java-gaming.org/70583333c4c12

I really cant find why it wont find res/textures/tiles.png

Is the resource folder a class folder in eclipse? Right click on the project -> Properties -> Java Build Path -> Libraries -> Add Class Folder… -> (select the res folder) and add it as a class folder.

Im using Intellij IDEA, do i need to open the project in eclipse?

Oh I’ve never used IntelliJ so I can’t help you there…

Let me get this straight though, It cant find the location of my tileset files, even though they are their?

Class.getResource()/getResourceAsStream() resolves resources relative to the class’es package.
Either use absolute classpath paths with a leading slash or use ClassLoader.getResource/getResourceAsStream.

I probably (didn’t test…) fixed the Exception that was thrown in the utility.

See first post, use snippet: v1.1

So good news and bad news,
I changed it to this as a test:
BufferedImage tileSheet = loader.load("/textures/tiles.png");
BufferedImage charSheet = loader.load("/textures/chars.png");
and it works… Sortof.
I am now introduced to a new Error lol.
http://pastebin.java-gaming.org/833cc6230411e

I Pushed my changes to github again if you wanna see for yourselves.

The new error is unrelated, you are specifying 0 or less as width to the SpriteSheet.crop() function - which calls getSubImage() - which complains about nonsensical input.

Thanks so much :smiley: