I'm developing Swing
based application in Java
I want a executable JAR file for this project.
All external library files used in the project should be packaged in the JAR file.
How can I build a runnable JAR file using ANT?
I'm developing Swing
based application in Java
I want a executable JAR file for this project.
All external library files used in the project should be packaged in the JAR file.
How can I build a runnable JAR file using ANT?
but it needs all external library files used in the project should be along with the jar.
Of course, but the external JARS should not be bundled in with the executable JAR.
You need to do three things:
You give clients the ZIP. They unpack it and execute your executable JAR.
You need to include the manifest
task in your jar
task. The manifest references the main class to be executed by default when you start your jar.
it could look like this :
<jar...
<manifest file="MANIFEST.MF">
<attribute name="Main-Class" value="com.example.YourMainClass"/>
</manifest>
</jar>