title: Is it possible to iterate over folders in jar file located in classpath?
body: <p>I have some Maven dependency with plenty of resources inside. I want to iterate over these resources in my code. How can I do it?</p>
  
  <p>I see several options.</p>
  
  <p>1) I may read Jat with some code similair to the one shown here: <a href="https://stackoverflow.com/questions/9630268/read-contents-of-jar-file-given-specific-path">Read contents of jar file given specific path</a></p>
  
  <p>The problem is that I have to specify exact path to mu jar file which is an issue because:</p>
  
  <ol>
  <li>it is located in classpath. I dont know exact path.</li>
  <li>it may change from build to build as it contains artefact version.</li>
  </ol>
  
  <p>2) I may read resources using Resources.getResource or some other typical "read-from-classpath" approach (like this one for example: <a href="https://stackoverflow.com/questions/20389255/reading-a-resource-file-from-within-jar">Reading a resource file from within jar</a>). But I have never seen any code that may read resources one by one from some folder. Only code which reads one resource with predefined name.</p>
  
  <p>Is there any ideal approach for my task?</p>