Here is the code to play wav files in java. It is pretty simple, so I do not think you will any problem.

public static void play(String soundFile) {
try {

InputStream stream = SoundPlayer.class.getResourceAsStream(soundFile);
if (stream == null)

return;
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(stream);
Clip clip =

(Clip) AudioSystem.getLine(new DataLine.Info(Clip.class, audioInputStream.getFormat()));

clip.open(audioInputStream);
clip.start();
stream.close();
audioInputStream.close();

} catch (Exception e) {

e.printStackTrace();

}
}

Advertisements