Recently I observed search patterns about Ant script to make executable JAR files, many end up on wrong pages of my blog. This blog post is for those who are searching for it. Its fairly easy and simple to use Ant Script, to make an executable JAR file, see the script below. <jar destfile="_dist/my-executable-jar.jar"> <fileset dir="_bin" /> … <manifest> <attribute name="Main-Class" value="com.mypackage.ClassWithMain" /> </manifest> </jar> As you can see, we usee the ‘jar’ ant task to create a JAR file, we want to create the JAR file with the name ‘my-executable-jar.jar’ – which is given as ‘destfile’ attribute value of ‘jar’ task and we wanted to include all the compiled classes which are available at ‘_bin’ directory – which is provided using ‘fileset’ tag in the second line of the script. Then comes the important part – th...
A techie who love to read, code and share ...