I have many sound and picture files I am using in a pokemon game I'm writing with Eclipse. Everything runs perfectly in Eclipse, but when I export it as a runnable jar, I get an error that the media is unavailable when I try running it.
This is the code I'm using for playing an mp3 file:
File file = new File("src/pokemon/mp3s/opening.mp3");
final String mediaLocation = file.toURI().toURL().toExternalForm();
Media media = new Media(mediaLocation);
mp = new MediaPlayer(media);
After exporting as a runnable jar, I execute it with java -jar Pokemon2.jar and get this error message:
Exception in thread "Main" MediaException: MEDIA_UNAVAILABLE : C:\Users\Nick\Desktop\src\pokemon\mp3s\opening.mp3 The system cannot find the path specified
How do I make my runnable jar be able to locate these additional resources?