문제

I have a jar file which contain another jar inside:

abc.jar --> a.class, b.jar, c.txt

which a.jar --> x.class, y.class

I want to add new class file z.class into a.jar & return abc.jar with updated a.jar

1 way is that extract & pack again.

Can I do it on-fly without extracting?

도움이 되었습니까?

해결책

The Jar tool provides a u option which you can use to update the contents of an existing JAR file by modifying its manifest or by adding files.

The basic command for adding files has this format:

jar uf jar-file input-file(s) In this command:

The u option indicates that you want to update an existing JAR file. The f option indicates that the JAR file to update is specified on the command line. jar-file is the existing JAR file that's to be updated. input-file(s) is a space-delimited list of one or more files that you want to add to the Jar file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top