GameMenuButton problem with .jar

Hi, my project works correctly on Eclipse but when I export it in .jar it doesn't find the images for my GameMenuButton.

I've tryed:

credits = new GameMenuButton("images/credits0.png", "images/credits1.png");

and it can't find file, I've tryed for the String url also:


or GameMenuState.class.getClassLoader().getResource("images/credits0.png").getFile()

and it said that sintax is incorrect.

with this two methods it works on eclipse but not from the .jar, and the problems comes only with GameMenuButton, in the other part I use always as URL


and it works fineā€¦but with .jar not!..why??..thanks!

use the ResourceLocator, you'll find examples on the forum in other threads

I've tryed:

try {
               new SimpleResourceLocator(GameMenuState.class.getClassLoader().getResource("images/")));
      } catch (URISyntaxException e1) {
         // TODO Auto-generated catch block
play = new GameMenuButton(ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, "play0.png").getFile(), ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, "play1.png").getFile());

but eclipse it works but not from jar!! I've FileNotFoundException  :?

I've lose 4 hours but in the end I've solved!

with this one: Binding.getInstance().setUseClassLoader(true);  :smiley:

ahh your using FengGUI :slight_smile:

glad you solved it