OK guys, so I'm trying to compile my game into a jar file, but I can't get the loading of images to work. When run from NetBeans, all is fine. But in the JAR, the URL is always null.
Here is the code I'm using:
URL url = this.getClass().getResource("/textures/Lava.jpg");
BufferedImage sourceImage = null;
try
{
sourceImage = ImageIO.read(url);
}
catch(IOException e)
{
System.out.println(e.getMessage());
}
I have tried unziping the JAR and checking the contents, my textures folder is there and the images inside also. Any ideas what I'm doing wrong?