How to update a single file of a zip

These days I investigated an OSGi problem and needed to update the MANIFEST.MF of a Java .jar file.

Extract the MANIFEST.MF from a jar-file:

$ unzip -o org.springframework.context.support_4.2.4.RELEASE.jar META-INF/MANIFEST.MF
Archive  org.springframework.context.support_4.2.4.RELEASE.jar
  inflating: META-INF/MANIFEST.MF

Edit the file and update the Java archive:

$ zip org.springframework.context.support_4.2.4.RELEASE.jar META-INF/MANIFEST.MF
updating: META-INF/MANIFEST.MF (deflated 79%)

Done.

Show Comments