How to build a distributable jar with Ant for a java project having external jar dependencies

Posted by Nikunj Chauhan on Stack Overflow See other posts from Stack Overflow or by Nikunj Chauhan
Published on 2011-11-26T07:42:48Z Indexed on 2011/11/26 9:53 UTC
Read the original article Hit count: 327

Filed under:
|
|
|

I have a Java project in Eclipse with class MainClass having main method in package :

com.nik.mypackage. 

The project also references two external libraries, which I copied in the lib folder in Eclipse and then added to build path using ADD JAR function. The libraries being one.jar and two.jar

This library is in lib folder in eclipse and added to the build path.

I want to create a executable JAR of the application using ant script. So that user can access my application using command:

c:>java -jar MyProject-20111126.jar

I know about the Eclipse plugin which directly exports a java application as runnable JAR. But I want to learn ant and the build process so manually want to create the build.xm.

© Stack Overflow or respective owner

Related posts about java

Related posts about ant