The java.applet.Applet
class contains two methods
which download a sound file from a particular URL and play it.
public void play(URL soundfile)
public void play(URL directory, String filename)
Normally these are used relative to the code base or the document
base for maximum portability. Alternately, the URLs can be
specified in one of the applet's PARAM
tags.
For example, the music you're hearing about now is produced by the following applet:
import java.applet.*;
public class SoundApplet extends Applet {
public void init() {
String soundfile = this.getParameter("soundfile");
if (soundfile != null) this.play(this.getDocumentBase(), soundfile);
}
}