title: How did I get a NullPointerException? Working with JApplet
body: <p>It's been a long time since I have worked with java and I forgot how to deal with a NullPointerException. The only thing I can think of is line 8. I'm not sure if that's how I'm supposed to retrieve an audio file from the same folder the java file is located in.</p>
  
  <p>This is my first time working with AudioClip. If that is the problem, what is the correct way to do it?
  Thank you in advance for any help/tips.</p>
  
  <p>If there is any other piece of information that I can provide, to help you help me, please let me know. :)</p>
  
  <p>[Purpose of this code is to create three buttons that will allow the user to play,loop, and stop the music]</p>
  
  <pre><code>import javax.swing.*;
  import java.applet.*;
  import java.awt.*;
  import java.awt.event.*;
  
  public class ProgAsThree extends JApplet
  {
     private AudioClip music = Applet.newAudioClip(getClass().getResource("Music.mp3"));
     private JButton jbtPlay = new JButton("Play");
     private JButton jbtLoop = new JButton("Loop");
     private JButton jbtStop = new JButton("Stop");
  
     public ProgAsThree()
     {
        JPanel panel = new JPanel();
        panel.add(jbtPlay);
        panel.add(jbtLoop);
        panel.add(jbtStop);
        add(panel);
  
        jbtPlay.addActionListener(new ActionListener()
        {
           @Override
           public void actionPerformed(ActionEvent e)
           {
              music.play();
           }
        });
  
        jbtLoop.addActionListener(new ActionListener()
        {
           @Override
           public void actionPerformed(ActionEvent e)
           {
              music.loop();
           }
        });
  
        jbtStop.addActionListener(new ActionListener()
        {
           @Override
           public void actionPerformed(ActionEvent e)
           {
              music.stop();
           }
        });      
  
       } 
   }                  
  </code></pre>
  
  <hr>
  
  <pre><code>java.lang.NullPointerException
  at sun.applet.AppletAudioClip.&lt;init&gt;(AppletAudioClip.java:65)
  at java.applet.Applet.newAudioClip(Applet.java:311)
  at ProgAsThree.&lt;init&gt;(ProgAsThree.java:8)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
  at java.lang.Class.newInstance0(Class.java:372)
  at java.lang.Class.newInstance(Class.java:325)
  at sun.applet.AppletPanel.createApplet(AppletPanel.java:795)
  at sun.applet.AppletPanel.runLoader(AppletPanel.java:724)
  at sun.applet.AppletPanel.run(AppletPanel.java:378)
  at java.lang.Thread.run(Thread.java:722)
  </code></pre>