title: Audio file cant be found
body: <p>So for ActionListener practice Im trying to make a program that keeps track of how many times i die to this enemy in a video game. Each time the button on the GUI is pressed it increases the counter by 1 and it also is supposed to play a sound.</p>
  <pre><code>import javax.swing.*;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.io.File;
  import java.io.IOException;
  import javax.sound.sampled.*;
  
  public class Main implements ActionListener {
  
      int bad = 0;
  
      private static JFrame frame;
      private static JPanel panel;
      private static JLabel bText;
      private static JLabel damn;
      private static JButton button;
      private static Clip clip;
  
      public static void main(String[] args) throws UnsupportedAudioFileException, IOException, LineUnavailableException {
  
          File file = new File(&quot;noise.wav&quot;);
          AudioInputStream audioStream = AudioSystem.getAudioInputStream(file);
          clip = AudioSystem.getClip();
          clip.open(audioStream);
  
          frame = new JFrame(&quot;times killed&quot;);
          panel = new JPanel();
          frame.setSize(420,420);
          frame.add(panel);
  
          panel.setLayout(null);
  
          bText = new JLabel(&quot;Times killed:&quot;);
          bText.setBounds(150,130,120,25);
          panel.add(bText);
  
          damn = new JLabel(&quot;0&quot;);
          damn.setBounds(210,158,120,25);
          panel.add(damn);
  
          button = new JButton(&quot;Lmao you bad&quot;);
          button.setBounds(140,190,150,25);
          button.addActionListener(new Main());
          panel.add(button);
  
          frame.setVisible(true);
  
      }
  
      @Override
      public void actionPerformed(ActionEvent e) {
  
          clip.start();
          clip.setMicrosecondPosition(0);
          bad++;
          damn.setText(&quot;&quot; + bad);
  
      }
  }
  </code></pre>
  <p>However when i run the program i get the error:</p>
  <pre><code>Exception in thread &quot;main&quot; java.io.FileNotFoundException: noise.wav (No such file or directory)
      at java.base/java.io.FileInputStream.open0(Native Method)
      at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
      at java.base/java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:157)
      at java.desktop/com.sun.media.sound.SunFileReader.getAudioInputStream(SunFileReader.java:117)
      at java.desktop/javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1060)
      at Main.main(Main.java:22)
      
  </code></pre>
  <p>The audio file is definitely in the source folder however and i need it there so when i make it into a jar file it brings the audio file with it.</p>
  <p><a href="https://i.stack.imgur.com/54FQR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/54FQR.png" alt="audio file in src folder" /></a></p>