Try this:
import java.io.*;
import java.applet.*;
import java.net.*;
public class PlayVariousMusicFiles{
private static AudioClip testClip;
private static URL testUrl;
public static void main(String args[]){
String fileName="arf.wav";
SoundTest(fileName);
testClip.loop();
boolean running = true;
while(running) {
}
}
public static void SoundTest(String fileName){
try{
testUrl = new URL("file://H:/arf.wav");
// Get current directory name, and build URL
testClip=Applet.newAudioClip(testUrl);
testClip.play();
System.out.println(testUrl.toString());
System.out.println("Should play");
}catch(Exception e){
System.out.println(e.toString());
}
}
This will make the application run forever until the window is closed or Ctrl-C is pressed (Windows).