Thursday, 18 July 2013

How to Make All .Jar and lip files in one JAR file . #net-Beans. #java

How to make my project in only one jar file using  net-beans?


In order to make the created JAR include the lips jar.
All what you need is to add below data in Build.xml of your project :




<target name="-post-jar">

     <!-- "MyJarName"  name of created new jar -->
    <property name="store.jar.name" value="MyJarName"/>

    <property name="store.dir" value="dist"/>
    <property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>

    <echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>

    <jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
        <zipgroupfileset dir="dist" includes="*.jar"/>
        <zipgroupfileset dir="dist/lib" includes="*.jar"/>

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

    <zip destfile="${store.jar}">
        <zipfileset src="${store.dir}/temp_final.jar"
        excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
    </zip>

    <delete file="${store.dir}/temp_final.jar"/>
    <delete dir="${store.dir}/lib"/>
    <delete file="${store.dir}/README.TXT"/>
</target>


Related Topics:


  • Click here to know how to crate jar file from your project.
  • Click here to change your .jar to .exe

No comments:

Post a Comment