title: Getting a directory inside a .jar
body: <p>I am trying to access a directory inside my jar file. 
  I want to go through every of the files inside the directory itself. I tried, for example, using the following:</p>
  
  <pre><code>URL imagesDirectoryURL=getClass().getClassLoader().getResource("Images");
  
  if(imagesFolderURL!=null)
  {
      File imagesDirectory= new File(imagesDirectoryURL.getFile());
  }
  </code></pre>
  
  <p>If I test this applet, it works well. But once I put the contents into the jar, it doesn't because of several reasons.
  If I use this code, the URL always points outside the jar, so I have to put the <code>Images</code> directory there.
  But if I use <code>new File(imagesDirectoryURL.toURI());</code>, it doesn't work inside the jar because I get the error <code>URI not hierarchical</code>.  I am sure the directory exists inside the jar.
  How am I supposed the get the contents of <code>Images</code> inside the jar?</p>