title: generate jar without dependencies
body: <p>I am generating a jar inside a java program by using the jdk system-compiler.</p>
  
  <p>I have some class files which I add into a jar:</p>
  
  <pre><code>JarOutputStream target = new JarOutputStream(jarStream, manifest);
  addClassFilesToJar(new File(classDirectory), target);
  </code></pre>
  
  <p>I have some dependencies which I added into the manifest as:</p>
  
  <pre><code>lib/dependency1.jar
  lib/dependency2.jar
  ...
  </code></pre>
  
  <p>Now the jar looks up in a sub-folder lib for the dependencies.</p>
  
  <p>The jar itself should not be a runnable standalone jar. I want to include the jar in a project where all the dependencies are already present.</p>
  
  <pre><code>MyApp/              &lt;-- Root folder of project
  MyApp/MyJar         &lt;-- folder for the generated jar lies
  MyApp/dependencies  &lt;-- folder for dependencies from MyApp and MyJar 
  </code></pre>
  
  <p>So what do I have to do, to generate the jar in a manner that the classpath argument itself given to the jvm will handle the dependencies? (wanted solution)</p>
  
  <p>Is it possible or do I have to create the manifest so that it points to the MyApp/dependencies folder? (not wanted solution)</p>