Easiest way to merge a release into one JAR file
Question:
To combine multiple JAR files into a single executable JAR, what tools or scripts are available? Specifically, a tool that can easily set the main manifest file and enable execution is desired.
Example:
Consider a Java restructured text tool that should be runnable via:
java -jar rst.jar
However, the downloaded ZIP file contains numerous dependencies despite having no apparent dependencies.
Answer:
Ant's zipfileset provides an effortless solution:
<code class="xml"><jar id="files" jarfile="all.jar"> <zipfileset src="first.jar" includes="**/*.java **/*.class"/> <zipfileset src="second.jar" includes="**/*.java **/*.class"/> </jar></code>
The above is the detailed content of How to Easily Combine Multiple JAR Files into a Single Executable JAR?. For more information, please follow other related articles on the PHP Chinese website!