How do I create an application that plays audio clips? The Applet class contains a newAudioClip method that can be called to load an audio clip. Once this audio clip has been loaded, AudioClip 's play and stop methods can be called to play this audio clip, and stop playing when necessary. The following Audio2 application demonstrates using newAudioClip to load an audio clip, which is subsequently played . // Audio2.java import java.applet.*; import java.net.*; class Audio2 { public static void main (String [] args) { if (args.length != 1) { System.out.println ("usage: java Audio2 url"); return; } try { URL url = new URL ("file:" + args [0]); AudioClip ac = Applet.newAudioClip (url); ac.play (); System.out.println ("Press any key to exit."); System.in.read (); ac.stop (); System.exit (0); } catch (Exception e) { System.out.println (e); } } } Suppose you have an audio clip file called laugh .wav. You can play this file by issuing the following command: java Audio2 laugh.wav |