Dear All: My directory structure is the following: libs/externa/ containing a.jar, b.jar libs/installed/ the generated runnable JAR file, "sample.jar", will be here
src/ containing Java source files build/ containing Java class files The main class is x.y.z.MyMain I have had a really hard time to create a runnable JAR file using Ant(version 1.6.5). The JAR file, libs/installed/sample.jar, can be generated. However, when I run it, the classes inside a.jar or b.jar are not available and causes NullPointerException. When I un-tar sample.jar, everything is there. I think manifest classpath is causing the problem. Following is my brief build.xml: <filelist id="external.jars" dir="libs/external"> <file name="a.jar" /> <file name="b.jar" /> </filelist> <path id="project.classpath"> <pathelement location="./build" /> <filelist refid="external.jars"/> </path> <target name="build" depends="init"> <javac debug="true" debuglevel="${debuglevel}" destdir="${build.dir}" source="${source}" target="${target}"> <src path="src" /> <classpath refid="project.classpath" /> </javac> </target> <target name="jar" depends="clean, build"> <pathconvert property="manifest.classpath" pathsep=" "> <mapper> <chainedmapper> <flattenmapper /> <globmapper from="*" to="libs/external/*" /> </chainedmapper> </mapper> <path> <filelist refid="external.jars"/> </path> </pathconvert> <jar destfile="libs/installed/sample.jar" basedir="./build" update="true"> <manifest> <attribute name="Main-Class" value="x.y.z.MyMain" /> <attribute name="Class-Path" value="${manifest.classpath}"/> </manifest> <fileset dir="${externals.dir}"/> </jar> </target> Thank you very much. -- View this message in context: http://ant.1045680.n5.nabble.com/Help-create-an-executable-JAR-file-including-3rd-party-JAR-files-tp5092771p5092771.html Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org