How to extract a folder from JAR
<p>I need to copy a folder, packed in a Jar on runtime. I want to do it by calling a function in a class which is also contained in the same folder.</p>

<p>I've tried using <code>getSystemResource</code>:</p>

<pre><code>URL sourceDirUrl = ClassLoader.getSystemResource("sourceDirName"); 
File sourceDir = new File(sourceDirUrl.toURI());
</code></pre>

<p>but it doesn't work.
I probably have to use <code>getResourceAsStream</code> function recursively. Is there a more elegant/strait-forward way to do this?</p>

<p>In case I have to do it recursively:
 1. I don't want to specify the files hard-coded, I want to do it dynamically 
 2. I don't want to create a separate archive. I want this resource to be in the same Jar as the classes dealing with it</p>

<p>Thanks</p>

<p>I ended up doing what Koziołek suggested below. Although I was hoping for a more elegant solution, but it looks like this is as good as it gets. </p>
