I use this code to play sounds in my application, but it only plays audio if it is in the project folder, not inside a package. And if I export my project by creating a .jar it does not include the media files. I've tried changing the path by adding the package, in this case sounds, but it does not play "/sons/audio.wav". Thanks.
try {
AudioClip c = Applet.newAudioClip(new File("audio.wav").toURL());
c.play();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}