I am looking for a JAR file generator fitting these requirements:

  • Able to create jar files containing other jar files
  • Makes creation and maintenance of manifest files easy.
  • 2
    What kind of complexities are we talking about? All of my .jar files (and their manifests) are built automatically by Apache Maven as a part of the build process. Feb 4 '14 at 23:15
  • PKZIP? (Or Info-ZIP…)
    – mirabilos
    Feb 4 '14 at 23:24
  • @Darth Android Actually, I am in a position where I quite often have to use ant for my projects
    – demongolem
    Feb 5 '14 at 1:51
  • @demongolem: What kind of jar are you trying to create exactly? List all of the "difficulties".
    – Nicolas Raoul
    Feb 10 '14 at 8:33
  • @Nicolas Raoul For one, classpath issues when packaging jar inside of my jar. That use case in itself gets mangled most of the time.
    – demongolem
    Feb 10 '14 at 14:10

For creating fat jars jarjar is a brilliant tool since it is easy to use, well maintained and has a good plugin support. It is also recommended by many libraries that typically require repacking such as ASM. Otherwise, build managers such as Maven or Gradle should offer you the functionality you are looking for out of the box. You should be able to pack recources in dependency of build profiles.


If you're looking to package your application together with its library JARs as one JAR file, you might consider the BSD-licensed One-Jar. One-Jar uses a custom classloader to load from JARs inside your main JAR file, while (based on its documentation) jarjar flattens all your classes into just one JAR file (no inner JARs), modifying class files as necessary.

Depending on your application, One-Jar's approach may work better (or worse) than jarjar's.


I think Maven is the tools that can do everything (with some configuration).

Exemple: I have a folder (./lib) where I have all my JAR files, I just have the following small pom.xml file like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">




    <!-- Put external dependencies here -->



Just run mvn clean install, and then you have all your lib/*.jar files in a new JAR.

If you need external Jars, you can just add it as a new dependency (in the section).

You want to manage the Manifest.MF, just have a look in this article, they explain how to use the maven-jar-plugin. Official documentation here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.