Hello,
I can't find a solution: I made a little game with Eclipse. Within my workspace I told Eclipse to create two folders src and bin. I manually added two folders pics and sound. Therefore my folder structure is looking like this:
1 2 3 4 5 6 7 8 9 10
| workspace |__Game |___bin |___pics |___sound |___org |___ .... |___src |___org |___ .... |
The sound files are loaded as following:
1 2 3
| URL sound_sub_url = getURL("./sounds/submarine.wav"); .... getClass().getClassLoader().getResource(sound_sub_url); |
This works fine as long as I'm testing my game in Eclipse. When I create a jar-file from my bin folder I receive a NullPointerException when starting the game from the jar. The NullPointerException happens when my program is trying to load the first sound file.
Is it a problem of my folder structure or should I create the URL a different way?