Whenever I open my .jar file, the sound will not work unless the files are in a folder titled "res" in the same directory as the .jar file. Now it will now work regardless of where the res folder is Here's my code
try {
InputStream defaultSound = Game.class.getResourceAsStream("/TrailsGameMusic.wav");
// getClass().getSy.getResource("/images/ads/WindowsNavigationStart.wav");
System.out.println("defaultSound " + defaultSound); // check the URL!
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(defaultSound);
Clip clip = AudioSystem.getClip();
clip.open(audioInputStream);
clip.loop(Clip.LOOP_CONTINUOUSLY);
} catch (Exception ex) {
ex.printStackTrace();
}