Here you can find the source of loadImage(String classRelativeFile)
public static BufferedImage loadImage(String classRelativeFile) throws IOException
//package com.java2s; /*//w w w . j a v a 2s . c o m * Copyright 2002 and later by MH Software-Entwicklung. All rights reserved. * Use is subject to license terms. */ import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; public class Main { public static BufferedImage loadImage(String classRelativeFile) throws IOException { InputStream is = ClassLoader.getSystemResourceAsStream(classRelativeFile); if (is == null) { throw new IOException(); } return ImageIO.read(is); } }