PlaySound.java

import java.applet.*; // for Applet, AudioClip
import java.net.URL;

/**
Applet utility methods can be used in applications!
*/
public class PlaySound
{
    public static void main(String[] argv)
    {
        try {
            URL u = new URL("file:ringin.wav");
            AudioClip sound = Applet.newAudioClip(u);
            sound.play();
            Thread.sleep(1000);  // play() starts a daemon thread...
            System.exit(0); // ...that we kill here.
            }
        catch (Exception e) {
            e.printStackTrace();
            }
    }
}