How to use JarOutputStream to create a JAR file?

Posted by Gili on Stack Overflow See other posts from Stack Overflow or by Gili
Published on 2009-08-15T05:23:14Z Indexed on 2010/06/02 19:03 UTC
Read the original article Hit count: 242

Filed under:
|

How does one create a JAR file programmatically using java.util.jar.JarOutputStream? 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 jar command-line tool to re-compress it the resulting library works fine. In short, something is wrong with my JAR file.

Please explain how to create a JAR file programmatically, complete with a manifest file.

© Stack Overflow or respective owner

Related posts about java

Related posts about jar