Here you can find the source of loadImage(String fileName)
public static Image loadImage(String fileName) throws IOException
//package com.java2s; //License from project: Open Source License import java.awt.Image; import java.io.File; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; public class Main { /**/*from ww w . j a v a 2 s. c o m*/ * Carga una imagen y retorna una instancia de la misma. Si hay algun * problema al leer el archivo lanza una excepcion. */ public static Image loadImage(String fileName) throws IOException { InputStream stream = ClassLoader.getSystemResourceAsStream(fileName); if (stream == null) { return ImageIO.read(new File(fileName)); } else { return ImageIO.read(stream); } } }