I have this image that I want to load but it always gives me an input= null exception. This is the first bit of code:
Entity e = new Entity("images/meganium.png");
Here is the part that loads the image:
image = null;
try{
path = this.getClass().getResource(fileName);
System.out.println(path);
image = ImageIO.read(path);
}catch(IOException e){
System.out.println("Dun goofed in " + "SPrites");
}
The structure is like this:
com/blah/bleh/Main
com/blah/bleh/images
com/blah/bleh/foo/bar/Loader Class
Stack trace:
java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1362)
at net.ofn.nyc.javagentleman.src.graphic.Sprite.<init>(Sprite.java:31)
at net.ofn.nyc.javagentleman.src.ent.Entity.<init>(Entity.java:21)
at net.ofn.nyc.javagentleman.JavaGentleman.<init>(JavaGentleman.java:27null)
at net.ofn.nyc.javagentleman.JavaGentleman.main(JavaGentleman.java:23)