Reputation: 1623
I have the following project structure in IntelliJ IDEA:
But when I run the code it throws an exception
Exception in thread "main" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1388)
Because I am loading image using the Main.Class.getResources() method and it seems it doesn't find then in the Resources folder. I tried to add the *.png pattern to compiler settings, but it doesn't work. Any idea how to make it work?
Upvotes: 1
Views: 1490
Reputation: 106410
There are two issues that I see; one being an IntelliJ problem, the other being a general naming problem.
First, you should mark the folder as a resources folder - right click on it and select "Mark Directory As" -> "Resources folder".
Next, make your resources folder name lowercase. Even if you're on a case insensitive platform, not having to deal with casing issues will make your life simpler.
Upvotes: 1