Playing audio in java using Sun.audio
I want just to perform a simple task. (I'm a java newbie). I want to play an audio clip when a button is clicked. here's the part of my code(which I did exactly by copying a tutorial from Youtube.) private void btnPlayActionPerformed(java.awt.event.ActionEvent evt) { InputStream in; try{ in=new FileInputStream(new File("C:\\Users\\Matt\\Documents\\dong.wav")); AudioStream timeupsound=new AudioStream(in); AudioPlayer.player.start(timeupsound); } catch(Exception e){ JOptionPane.showMessageDialog(null, e); } } But the problem is, this doesn't work. It throws and IOException saying: "could not