How to use jardesc in Eclipse?

11,768

I got the same error message ("duplicate entry") when, in my case

  • I checked the option to include an existing manifest file.
  • AND I specified to include MANIFEST.MF among the files to be included in the .jar.

Once I excluded MANIFEST.MF in the "Select the resources to export:" file tree of the jar generation wizard, the warning disappeared.

As for including referenced projects with your jar, I recommend making them into jar files as well, and including those in the project you want to make a jar of.

Then, make sure to set the manifest's classpath correctly.

Share:
11,768
maaartinus
Author by

maaartinus

Updated on June 04, 2022

Comments

  • maaartinus
    maaartinus almost 2 years

    I want to create an executable JAR-file from my eclipse project. It references other projects, which also reference other projects (and so on) and some JAR files.

    According to this answer, everything should go "within 2 clicks". But not for me:

    It reports a warning:

    Problem writing mg/build/classes/META-INF/MANIFEST.MF to JAR: duplicate entry: META-INF/MANIFEST.MF duplicate entry: META-INF/MANIFEST.MF

    It looks like it tries to include existing manifests from all projects, which simply doesn't make sense. I actually do not want to include any of them, just to generate a new one. I haven't found any way to switch it off. OK, it's just a warning.

    It looks like I need to manually take care of all the referenced jar files... actually, Eclipse knows them, I do not.

    I need to either include the content of all the referenced jar files or to copy all of them into the target folder and list them in the Manifest. I've got no idea how to do it.

    I also wonder if the jardesc file is usable from ant build scripts.