title: How to use JarOutputStream to create a JAR file?
body: <p>How does one create a JAR file programmatically using <code>java.util.jar.JarOutputStream</code>? The JAR file produced by my program looks correct (it extracts fine) but when I try loading a library from it Java complains that it cannot find files which are clearly stored inside it. If I extract the JAR file and use Sun's <code>jar</code> command-line tool to re-compress it the resulting library works fine. In short, something is wrong with my JAR file.</p>
  
  <p>Please explain how to create a JAR file programmatically, complete with a manifest file.</p>