java.lang.IllegalArgumentException: input == null! when using ImageIO.read to load image as bufferedImage

前端 未结 10 1993
予麋鹿
予麋鹿 2020-11-27 22:14

This is a question that has been asked like 100 times on this site, but I have looked at all of them and even though they all were solved, none of the solutions worked for m

10条回答
  •  不知归路
    2020-11-27 22:59

    Try This

    private BufferedImage get(String path) throws IOException{    
        URL url = this.getClass().getClassLoader().getResource(path);     
        String thing = url.getFile();       
        return ImageIO.read(new File(thing));      
    }
    

提交回复
热议问题