我下载了一个样本" beep"音频文件,我想从我的Java应用程序中播放它。
到目前为止,这是我的代码尝试:
public class pomodoroFifteen {
public static void main(String[] args) {
// TODO Auto-generated method stub
protected AudioClip beep;
protected relativeBeepPath = "mybeep.wav";
for (; ; ) {
try {
Thread.sleep(1000 * 6 ); // Sleep 15 minutes
Thread.sleep(1000 * 6 ); // Sleep 5 minutes
try {
beep = getAudioClip( new URL( getDocumentBase(), relativeBeepPath ) );
} catch( Exception ex ) {
ex.printStackTrace();
}
System.out.print("hi");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}