Question

I was trying to, for debugging purposes, inject a (hacked) META-INF/MANIFEST.MF file into a jar. I created a META-INF dir at the same level where the jar is and created my MANIFEST.MF file in it. Then, per this tutorial:

jar uf myjar-with-dependencies.jar META-INF/MANIFEST.MF

which executed without error but just wiped out the existing manifest without replacing it. I know it because I ran:

jar tf myjar-with-dependencies.jar | grep MANIFEST

which, before the update, returned the found file in the jar but does not now after the update.

Was it helpful?

Solution

"jar ufm" is what you're after. The m argument specifies that you're providing a manifest file.

jar ufm <yourJar> <yourManifest>

Otherwise it just treats it as a regular file which will end up getting stomped on when it generates the default manifest file.

OTHER TIPS

A Jar is just a zip file. You can open it up using any tool you would normally use to open a zip file and then just place your file inside of it where you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top