Basically I'm trying to load some image data into java as an ImageIcon object. I originally tried simply doing ImageIcon image = new ImageIcon(filename), but that made it so the images didn't load up when exported as a JAR file. The new way I've done it is as so:

```
private static ImageIcon getImage(String filename) {
    try {
        URL url = PacMan.class.getResource(filename);
        Image image = ImageIO.read(url);
        return new ImageIcon(image);
    }
    catch (IOException e) {
        e.printStackTrace();
    }

    return null;
}

```

The error is because PacMan.class.getResource(filename) returns null. My directory is such that my PacMan class is in src/Model/PacMan and my images have the following file paths:

```
src/Model/PacMan_Images/PacMan_EAST, 
src/Model/PacMan_Images/PacMan_SOUTH, 
src/Model/PacMan_Images/PacMan_WEST, 
src/Model/PacMan_Images/PacMan_NORTH. 

```

Also, I've tried reverting back to using new ImageIcon(filepath) and the image loads up fine so I know the image exists in my directory. Anybody know what might be the problem?

Edit: My error is that I get an IllegalArgumentException thrown because I'm passing null as a parameter for ImageIO.read(url), because url is null.