0

I created a game and i wanted to create a jar. So i used Fat Jar Eclipse Plugin to create one http://fjep.sourceforge.net/

However, When i open it up, i just see a blank screen. To get my images im using commands like

new File(System.getProperty("user.dir") + "/Images/MainMenu/MainMenuButton_1.PNG"

So im am unsure why it is not working.

Edit: I figured out that it works if it is in the same directory as my project How to i get it so it doesnt have to be

Eric Sauer
  • 870
  • 4
  • 14
  • 27
  • 1
    Do you have any hard-coded file-paths? Are you using any other resources in your project directory? – beatgammit Apr 17 '11 at 08:17
  • [Duplicate] (http://stackoverflow.com/questions/1662686/images-will-not-work-in-a-jar-file) , easily found with the search. Please search a little before asking. – user unknown Apr 17 '11 at 11:19

1 Answers1

1

The behaviour described is consistent with the load thread exiting due to an uncaught FileNotFoundException, before having add anything to the pane shown.

I can strongly recommend printing out file.getAbsolutePath() when you encounter FileNotFoundExceptions as that information is not present in the exception message. This will help you find out why the file name was broken.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347