Using Eclipse IDE. The line:
getClass().getResource("/res/bitmaps/image.png");
returns null
. I have created the res
folder in the root of my project.
The code of interest is:
bImage = ImageIO.read(getClass().getResource("/res/bitmaps/image.png"));
and it throws the exception:
Exception in thread "main" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1378)
at com.example.game.resource.Resources._loadImage(Resources.java:31)
at com.example.game.GameComponent.<init>(GameComponent.java:19)
at com.example.game.GameFrame.<init>(GameFrame.java:8)
at com.example.game.GameFrame.main(GameFrame.java:13)
Any help?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…