I know questions like this have been asked before, but I have looked and tried a lot of the answers and none of them work. I am trying to use an image inside a .jar file. The image is stored in the directory /world/maps/map1.jpg.
BufferedImage bigImg;
try
{
bigImg = ImageIO.read(getClass().getResourceAsStream("/world/maps/" + name + ".jpg"));
}
catch(Exception e)
{
System.out.println(e + ": is the error");
bigImg = null;
}
Thanks for the help.
forgot to make it clear but class file is in the same directory as image