title: How to read a directory from the runtime classpath?
body: <p>My Java application needs to be able to find a <code>myconfig/</code> directory which will be bundled inside the same JAR:</p>
  
  <pre><code>myjar.jar/
      com/
          me/
              myproject/
                  ConfigLoader.java --&gt; looks for myconfig/ directory and its contents
      myconfig/
          conf-1.xml
          conf.properties
          ... etc.
  </code></pre>
  
  <p>How do I actually go about reading this <code>myconfig/</code> directory off the runtime classpath? I've done some research and it seems that the normal method of reading a <strong>file</strong> from the classpath doesn't work for <strong>directories</strong>:</p>
  
  <pre><code>InputStream stream = ConfigLoader.class.getResourceAsStream("myconfig");
  </code></pre>
  
  <p>So does anyone know how to read an entire directory from the runtime classpath (as opposed to a single file)? Thanks in advance!</p>
  
  <p>Please note: It is not possible to load the files individually, <code>myconfig</code> is a directory with thousands of properties files inside it.</p>