Q:

Display an image in java

public void loadStdImage() throws IOException
{
    Image image = ImageIO.read(this.getClass().getResource("/Resources/Images/Student/Capture.png"));  //Line 350
    ImageIcon icon = new ImageIcon(image);
    JLabel lblImage = new JLabel(icon);
    lblImage.setIcon(icon);
    lblImage.setBounds(753, 50, 149, 171);
    add(lblImage);
}

I tried many things... but nothing works out. Continuously showing the following run-time error
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null!
    at javax.imageio.ImageIO.read(Unknown Source)
    at View.Student.loadStdImage(Student.java:350)

Project folder structure is:

edit:
Found the solution. See the change of icon of the resource folder in the following picture and the above image. I added my resource folder to Java Build Path. Right click on your project, go to properties, then select 'Java Build Path', from there add your folder to java build path.
Cheers
enter image description here

A:

welcome to SO. As you are new here, please read this - https://stackoverflow.com/help/mcve
Let me help you with this for now.
I have standard Eclipse project:

and my test class looks like (minimal):
package q34460547;

import java.awt.Image;
import java.io.IOException;

import javax.imageio.ImageIO;

public class LoadTest {

    public static void main(String[] args) throws IOException {
        new LoadTest().loadStdImage();
    }

    public void loadStdImage() throws IOException {
        Image image = ImageIO.read(this.getClass().getResource("/ScreenShot005.png"));
    }

}

and now, when I used
ImageIO.read(this.getClass().getResource("/ScreenShot005.png"));

image is loaded from res so called source folder in Eclipse.
When I used
ImageIO.read(this.getClass().getResource("ScreenShot005.png"));

image s loaded from the folder in which LoadTest.java file is (to be precise it is also compiled to same folder - in Eclipse it's bin).
You can find more info for example here - What is the difference between Class.getResource() and ClassLoader.getResource()?
edit:
The image has to be on classpath (when using Class.getResource), that's why it was not loaded from Resources folder. There are two options, use another version of ImageIO.read() or make your Resources folder a source folder:

