Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error creating jar archive contains more than 65535 entries

Tags:

java

eclipse

ant

I am trying to build a jar file and getting error Build Failed.

Problem creating jar: archive contains more than 65535 entries. (and the archive is probably corrupt but I could not delete it)

I am using Eclipse Neon Release 1 with JDK 1.8.0_101 and Ant version in eclipse is 1.9.6.

below is my ant build file :-

<property name="jar.name" value="ABC.jar" />
<property name="source.root" value="src" />
<property name="class.root" value="bin" />
<property name="lib.dir" value="lib" />
<property name="jar.dir" value="C:\D\ABC-Exe" />
<property name="Main-Class" value="com.abc.xxx.main.ABCEval" />
<property name="conf.pkj" value="com/abc/xxx/business/configurations" />
<property name="img.pkj" value="com/abc/xxx/business/images" />

<path id="project.class.path">
    <pathelement location="${class.root}" />
    <fileset dir="${lib.dir}">
        <include name="*.jar" />
    </fileset>
</path>

<target name="clean" description="cleans up build structures">
    <delete dir="${class.root}" />
    <delete file="${jar.dir}/${jar.name}" />
</target>

<target name="prepare" description="sets up build structures">
    <mkdir dir="${class.root}" />
</target>

<target name="compile" depends="prepare" description="Compiles all java classes">
    <javac srcdir="${source.root}" destdir="${class.root}" debug="on" optimize="off" deprecation="on" source="1.8" target="1.8" includeantruntime = "false">

        <classpath refid="project.class.path" />
    </javac>

    <mkdir dir="${class.root}/${conf.pkj}" />
    <mkdir dir="${class.root}/${imwg.pkj}" />

    <copy todir="${class.root}/${conf.pkj}">
        <fileset dir="${source.root}/${conf.pkj}" />
    </copy>

    <copy todir="${class.root}/${img.pkj}">
        <fileset dir="${source.root}/${img.pkj}" />
    </copy>

</target>

<target name="jar" depends="compile"> 

    <delete file="${jar.dir}/${jar.name}" quiet="true" failonerror="false" />

    <jar destfile="${jar.dir}/${jar.name}">

        <fileset dir="${class.root}" includes="**/*.*" />
        <fileset dir="${source.root}" includes="**/api/*.java,**/api/vo/*.java"/>

        <zipgroupfileset dir="${lib.dir}" />


        <manifest>
            <attribute name="Main-Class" value="${Main-Class}" />
            <attribute name="Class-Path" value="." />
        </manifest>

    </jar>


</target>


<target name="run">
    <java fork="true" classname="${Main-Class}">
        <classpath>
            <path location="./${jar.name}" />
        </classpath>
    </java>
</target>

like image 603
Varun J Avatar asked Sep 16 '16 05:09

Varun J


1 Answers

Specify the zip64Mode argument on your jar task to say that you need to use the large 'zip64' format:

<jar destfile="${jar.dir}/${jar.name}" zip64Mode="always">
like image 150
greg-449 Avatar answered Oct 14 '22 16:10

greg-449