Q:

Creating library jar with other libraries

I am creating jar via eclipse, but not runnable jar, it is just a library.  After importing that i'm creating new project and adding this jar file.  But when run application it throws exception about not finding libraries which are inside in my jar.  But these libraries are included in created jar.  Where is my mistake ?  How can I do that ? 

A:

I found the solution.  I write some ant script for creating jar and it was solved my problem.  
<target name="dist" depends="build-jar">

    <property name="store.jar.name" value="MYJARNAME"/>

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

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

    <mkdir dir="dist"/>
    <delete dir="${store.dir}"/>
    <mkdir dir="${store.dir}"/>
    <mkdir dir="dist/lib"/>
    <copy todir="dist/lib/" overwrite="false" granularity="9223372036854">
        <fileset dir="lib/"/>
    </copy>
    <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"/>

</target>

