简体   繁体   中英

How to extract and separate one jar file into several?

Say I have a .jar file Test.jar which which includes a.jar and b.jar as the dependency.

I want to achieve following:

  • make new jar, so that it doesn't contain a.jar and b.jar and while launching from command line, pass them as arguments. ie java -jar Test.jar -cp "a.jar; b.jar"

You could extract your Test.jar into one directory, move the a.jar and b.jar out to a separate directory and then repack the Test.jar back:

jar x Test.jar
mv <path to a.jar> <new path>
.. - do same for b.jar
jar cf Test.jar -C <classes dir>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM