IllegalArgumentException ?

[quote]Exception in thread “main” java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)
at sAdv.Board.loadImages(Board.java:81)
at sAdv.Board.(Board.java:22)
at sAdv.GameLoop.(GameLoop.java:17)
at sAdv.GameLoop.main(GameLoop.java:34)
[/quote]
This is error is new to me.

This is how I load my images.


background = ImageIO.read(this.getClass().getResource("res/bg.png"));

I would really appreciate an answer since I have to send it to my teacher in 3 hours :confused:

Have you checked, double checked and checked again your path so it´s correct? :slight_smile: If you´re using Eclipse, have you “refreshed”? Sometimes refresh doesn´t work for me so at times I´ve had to open up the .png file (in the project folder in Eclipse) in a text editor, type a character and remove it so I can save the file again. That can help…

I will try the “add and remove character” ^^

EDIT: Couldnt do it, some character ecoding problems…
Checked the build path and it’s fine.

Well, considering that it’s telling you that the input to ImageIO.read() is null, then this.getClass().getResource(“res/bg.png”) must be the problem. :slight_smile:

look at these:


Thank you very much!
Moving my images from the res folder and directly into the src folder worked :slight_smile: