I have a simple program that will play the wav files when executed. But the sound doesnt play. Here is the code
import javax.swing.*;
import java.awt.*;
import java.net.*;
import java.beans.*;
import java.io.*;
import java.applet.*;
import java.awt.event.*;
public class test extends JPanel
{
public static void main(String args [])
{
try{
URL dance = new URL("file:res/hallelujah.wav");
AudioClip danceClip = Applet.newAudioClip(dance);
danceClip.play();
} catch (Exception e)
{
e.printStackTrace();
}
}
Can anyone the error? Thanks