Is it possible to have a jar Manifest to use all jars in a folder
<p>I'm trying to set a jar manifest so it loads all the libraries (jars) within a folder next to the jar.</p>

<p>The manifest looks like this:</p>

<pre><code>Manifest-Version: 1.0
Class-Path: libs/
Main-Class: path.to.my.class.Main
</code></pre>

<p>The layout is as follows:</p>

<pre><code>- MyJar.jar
- libs/
-----lib1.jar
-----lib2.jar
</code></pre>

<p>And I'm trying to run like this:</p>

<pre><code>java -jar MyJar.jar
</code></pre>

<p>And I get NoClassDefinition errors about classes in the jar within the folder.</p>

<p>In case someone is curious, this folder might contain optional jars that are processed during class loading. That' swhy I can't use the hardcoded or autogenerated ones.</p>

<p>Any idea?</p>

<p><strong>Update</strong>
Rephrased the question as this is not currently possible from the manifest itself. The answer was the only really viable without the need of extracting the jars, although it also works.</p>

<p>So as a summary the answer is no, this can't be done from manifest file alone if you have unespecified dependencies.</p>