import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author mark */ public class BeepTest { public static void main(String[] args) throws Exception { AudioInputStream is = AudioSystem.getAudioInputStream(BeepTest.class.getResourceAsStream("/blip.wav")); Clip clip = AudioSystem.getClip(); clip.open(is); // test repeatable playing of audio for(int i = 0; i<10; i++) { if(clip.isRunning()) clip.stop(); clip.setFramePosition(0); // rewind to start of clip clip.start(); Thread.sleep(100); } } }