title: Playing Sound in Java
body: <p>Hello I'm trying to play a sound in java the code looks like this:</p>
  
  <pre><code>public void playSound(String sound) {
      try {
          InputStream in = new FileInputStream(new File(sound));
          AudioStream audio = new AudioStream(in);
          AudioPlayer.player.start(audio);
      } catch (Exception e) {}
  }
  </code></pre>
  
  <p>I imported sun.audio*; however get an error: </p>
  
  <blockquote>
    <p>Access restriction: The type 'AudioPlayer' is not API (restriction on
    required library 'C:\Program Files\Java\jre7\lib\rt.jar')</p>
  </blockquote>