title: Finding files for playing sound
body: <p>I'm trying to make an application where when I click a JButton, it plays a song. I've already figured out how to specify JButtons. However, I can't seem to find a way to play sound. I'm not going to use sun.audio, so many of the threads that I looked at didnt work. I found many low quality answers. Eventually, I settled on this code.</p>
  
  <pre><code>public static synchronized void playSound(final String url) {
    new Thread(new Runnable() {
  public void run() {
    try {
          Clip clip = AudioSystem.getClip();
          AudioInputStream inputStream = AudioSystem.getAudioInputStream(
          Main.class.getResourceAsStream("/path/to/sounds/" + url));
          clip.open(inputStream);
          clip.start(); 
        } catch (Exception e) {
          System.err.println(e.getMessage());
        }
      }
    }).start();
  }
  </code></pre>
  
  <p>Inside my src folder, I have a folder called "Songs". I changed the file path to this:
  /Songs/</p>
  
  <p>Then, I tried calling the function using a wav file:</p>
  
  <pre><code>playSound("song.wav");
  </code></pre>
  
  <p>And then I get a null error. I believe that this is because it does not recognize the file path. The answer to my problem is most likely very obvious, but somehow I cant find it.</p>