title: Audio: background music in java JFRAME
body: <p>What is wrong in my codes? it have warnings about SUN API. it may remove in future release, it said.. </p>
  
  <pre><code>import java.io.*;
  import java.net.*; 
  
   import sun.audio.AudioData;
   import sun.audio.AudioPlayer;
   import sun.audio.AudioStream;
   import sun.audio.ContinuousAudioDataStream;
  
  AudioPlayer myBackgroundPlayer = AudioPlayer.player;
  ContinuousAudioDataStream myLoop = null;
              //use a try block in case the file doesn't exist.
            try {
  
                AudioStream myBackgroundMusic = new AudioStream(new FileInputStream("Audio/loop2.wav"));
                AudioData myData = myBackgroundMusic.getData();
                myLoop = new ContinuousAudioDataStream(myData);
                }
                catch(Exception error) {JOptionPane.showMessageDialog(null, "Invalid file!");}
  
                //play background music.
                myBackgroundPlayer.start(myLoop);
  </code></pre>
  
  <p>invalid file it said when i run this codes..</p>