How do we play sound (a music file of any format like .wma, .mp3 ) in a Java desktop application? (not an applet)
I have used the following code (taken from another question on Stack Overflow) but it throws an Exception.
public class playsound {
    public static void main(String[] args) {
s s=new s();
s.start();
    }
}
class s extends Thread{
    public void run(){
        try{
            InputStream in = new FileInputStream("C:\\Users\\srgf\\Desktop\\s.wma");
         AudioStream as =    new AudioStream(in); //line 26
            AudioPlayer.player.start(as);
        }
        catch(Exception e){
            e.printStackTrace();
            System.exit(1);
        }
    }
}
The program when run throws the following Exception:
java.io.IOException: could not create audio stream from input stream
    at sun.audio.AudioStream.<init>(AudioStream.java:82)
    at s.run(delplaysound.java:26)
 
     
     
    