Creating a Jar - Getting blank screen
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
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.
精彩评论