title: Get all file names from resource folder in java project
body: <p>Right now I'm manually writing song file names into a String array, then sending the strings to <code>InputStream is = this.getClass().getResourceAsStream(filename);</code> to play the song.</p>
  
  <p>I would rather loop through all the song names in my resources folder and load them into the array so that each time I add a song, I don't need to manually type it into the array.</p>
  
  <p>All of my songs are located in <code>resources</code> folder:</p>
  
  <p><img src="https://i.stack.imgur.com/hmqff.png" alt="enter image description here"></p>
  
  <p>Is there a java method or something to grab these names?</p>
  
  <p>The files need to work when I export as <code>.jar</code>.</p>
  
  <p>I thought I could use something like this?</p>
  
  <p><code>InputStream is = this.getClass().getClassLoader().getResourceAsStream("resources/");</code></p>
  
  <p>Is there a <code>listFiles()</code> or something for that?</p>
  
  <p>Thanks</p>