Java: getResource image, cannot be found.
问题 I just came up with an error in Java (using Eclipse). I want to load an image from the resource folder into the application. Using the follwoing lines: URL url = this.getClass().getClassLoader().getResource("/resources/images/icon.png"); BufferedImage i = ImageIO.read(url); But this results in a java.lang.IllegalArgumentException: input == null! exception. My folder structure is: How can I access this image? Thank you a lot! 回答1: getResource() returns null if it can't find the resource on the