Sunday, 15 September 2013

Exported jar file freezes after executing

Exported jar file freezes after executing

Hi I've been having problems trying to export my java code into a runnable
jar file.
When I double click the .jar file it starts up but for some reason the
only image that I use doesn't show up (since this was a basic test all the
objects are draw using shapes from what I think is java.awt). So the only
thing that doesn't show up is a bullet sprite in which I put in a data
folder next to the src folder.
The main problem is that it seems to crash or freeze after a few seconds
of running the game. (I'm was using eclipse to run it and it worked fine).
Now I'm not that experienced with making this without the compiler so I'm
not sure if I had missed anything when making this program
Here is what I have to get the image (which I believe is the main problem):
private BufferedImage pShot;
//then in the public World method
try {
pShot = ImageIO.read(new File("data/bulletShot2.png"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

No comments:

Post a Comment