Full local path (C:\\Users\\workspace\\myproject\\src\\eclipse\\mainclass\\icons\\my-image.png) works fine, but using the short path like in the code below, gives an exception javax.imageio.IIOException: Can't read input file!.
What am I doing wrong here?
JLabel lab_h1 = new JLabel();
BufferedImage img = null;
try {
img = ImageIO.read(new File("icons/my-image.png"));
} catch (IOException e) {
e.printStackTrace();
}
Image dimg = img.getScaledInstance(140, 40,Image.SCALE_SMOOTH);
lab_h1.setIcon(new ImageIcon(dimg));