title: Java- How to use the library jlayer to play audio?
body: <p>I am trying to use an API by JZoom called JLayer which allows one to play audio files among other things. I downloaded the JLayer 1.0.1 version. Here is the link to their website: <a href="http://website" rel="nofollow">http://www.javazoom.net/javalayer/sources.html</a>.I have found this code which attempts to play an audio file called <code>audio.mp3</code>:</p>
  
  <pre><code>import javazoom.jl.*;
  import java.io.FileInputStream;
  
  public class Sound {
  
      public static void main(String arg[]) {
          try {
              FileInputStream file = new FileInputStream("C:\\Users\\Sam\\Desktop\\dreamBeatsWorkspace\\dreamBeats\\audio.mp3");
              Player playMP3 = new Player(file);
              playMP3.play();
          } catch (Exception e) {
          }
      }
  
  }
  </code></pre>
  
  <p>When I write this in Eclipse it underlines the <code>Player</code> part of <code>Player playMP3 = new Player(file);</code> and asks for a Player class. I assume this means that the Player class is not defined. On the other hand I have tried to download and implement the JLayer library by going to <code>Window-&gt;Preferences-&gt;Java-&gt;Build Path-&gt;User Libraries</code>. Then I created a new folder called <code>audio lib</code> and went to <code>Add External JARS...</code> from their I chose the files <code>jl1.0.1</code> in <code>C:\Users\Sam\Desktop\jlayer1.0.1\JLayer1.0.1</code>, <code>Player.class</code> in <code>C:\Users\Sam\Desktop\jlayer1.0.1\JLayer1.0.1\classes\javazoom\jl\player</code> and <code>Player.java</code> in <code>C:\Users\Sam\Desktop\jlayer1.0.1\JLayer1.0.1\src\javazoom\jl\player</code> then hit open for all of them and finally I hit OK. I proceed to write my code in a new class I created called Sound. Finally when I ran this code this error message popped up in the console:</p>
  
  <pre><code>Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
      Player cannot be resolved to a type
      Player cannot be resolved to a type
  
      at Sound.main(Sound.java:9)
  </code></pre>
  
  <p>I am assuming I need to find a way to make a class path to where the Player class is defined. I don't know how to do this and Ideas on <strong>how to build a class path to the location of the Player class in the Eclipse software</strong> would be very helpful. All ideas on <strong>what went wrong</strong> and <strong>how one can play an audio file with the JLayer library</strong> would be much appreciated. Thank you for your help!</p>