How to build a jar using an own MANIFEST.MF in Eclipse

I have a custom MANIFEST.MF in my java-project in Eclipse.

When exporting the project to a jar, I choose

Use existing manifest from workspace

Extracting the .jar shows that eclipse generated its own manifest.

My manifest:

Manifest-Version: 1.0 
Main-Class: de.somehow.tagPDF.Main
Class-Path: lib/iText-5.0.2.jar;lib/jxl.jar;lib/jai_codec.jar;lib/jai_core.jar

How can I fix this?


You can make use of a build.xml to build the jar file for you.

Then you just run the build.xml as a Ant task.


If you want the build.xml to run automatically every time you build your Eclipse project, you can add it to the Builders list.


Below is a sample build.xml where a custom manifest is used:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="Example" default="run_build">

    <property name="guiJar" value="../../Library/<jar-name>.jar"></property>

    <target name="run_build" depends="delete_old_jar,create_dirs,create_manifest,copy_all_class_files,create_jar,delete_temp_dirs">

    <target name="delete_old_jar">
        <delete file="${guiJar}">

    <target name="create_dirs">
        <mkdir dir="jar_temp" />
        <mkdir dir="jar_temp/META-INF" />

    <target name="delete_temp_dirs">
        <delete dir="jar_temp">

    <target name="create_manifest">
        <manifest file="jar_temp/META-INF/MANIFEST.MF">
            <attribute name="Manifest-Version" value="1.0" />
            <attribute name="Version" value="1.0.0" />
            <attribute name="Company" value="Value" />
            <attribute name="Project" value="Value" />
            <attribute name="Java-Version" value="${java.version}" />
            <attribute name="Class-Path" value="test.jar" />
                    <attribute name="Main-Class" value="com.Main" />

    <target name="create_jar">
        <jar destfile="${guiJar}" manifest="jar_temp/META-INF/MANIFEST.MF" basedir="jar_temp">

    <target name="copy_all_class_files">
        <copy todir="jar_temp">
            <fileset dir="classes">
                <include name="*/**" />

Need Your Help

How to group Multivalued Value with LINQ?

c# linq solr

Im my model I have decleared value from wich I have to group, like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.