Merge operations for multiple jars

Source: Internet
Author: User

Colleagues want to write the packaging tools under the Android platform and encounter the problem of merging multiple jars into one jar. Here is a list of the steps to proceed:

1. Copy all jar files to a temporary directory and extract all the. class files through the jar command

> JAR-XVF Xx.jar

Xx.jar must be a specific jar, cannot be *.jar, will be reported FileNotFoundException

2. Delete all jar files in temp directory

> del/f *.jar

3. Merge all. class files to the jar, you need to switch to the temp directory, otherwise the generated jar will contain the temp directory

> JAR-CVFM Game.jar.

The jar command does not support "extracting" resources into the specified directory, so use the above method. However, when generating the final jar, I encountered a very deceptive place, using Jd-gui.exe to view the directory structure in the jar, and found that it would carry the "drive letter: Temporary directory" layer, no matter how I adjust the command, drag the jar into the look, it comes with the directory. Finally let the other use the same command in his machine test found that there is no problem, and finally I restarted jd-gui.exe again to see the previous generated jar discovery is normal.

More about jar-related commands can be parameters here:

Jar Command &jar Package detailed >>

Merge operations for multiple jars

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.