Hi I've made two programs: one is a level editor and the other one is a mario clone game.
I did: project structure-> artifacts and i've created a jar for both application.
Now if i run the level editor's jar works without any problem. If i run the game's jar it doesn't start and i get:
Exception in thread "main" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1348)
at com.platform.game.window.BufferedImageLoader.loadImage(BufferedImageLoader.java:15)
at com.platform.selectlevel.LevelsFinder.<init>(LevelsFinder.java:60)
at com.platform.game.window.Menu.<init>(Menu.java:72)
at com.platform.game.window.Window.addMenu(Window.java:55)
at com.platform.game.window.Window.<init>(Window.java:31)
at com.platform.game.window.Game.main(Game.java:272)
if i compile inside the editor it works good, how can i fix that ? any tips ?
BufferedImageLoader:
public class BufferedImageLoader {
private BufferedImage image = null;
public BufferedImage loadImage(String path){
try {
image = ImageIO.read(getClass().getResourceAsStream(path));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return image;
}
}
i got the exception only when i run the game from a jar and not from the IDE, just would like to know why? somebody knows that ?