Recently I was compiling a Java
game and encountered the following problems when processing pictures:
Full error message
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null!
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1356)
at ImageIOTest.main.<init>(main.java:23)
code segment
BufferedImage img = ImageIO.read(getClass().getResourceAsStream(FILENAME));
Solution
Many searches on the Internet say that the path of the picture is wrong, but I have checked the path of the picture 555 n 555n5 5 5 n times, no problem
so? No way?
In fact, it's right to change it like this:
BufferedImage img = ImageIO.read(new File(FILENAME));