2 Minutes To Code (β Version)

'jar' command - 2 minute tutorial

How to add customized manifest file when creating a jar file

A shrewd observer would have noticed in the Basic Usage example that the jar command adds META-INF/MANIFEST.MF file to the jar file.

The jar file structure specification mandates that jar files must have a manifest file.

If you need to provide your own manifest file, use the option -m as in the command jar -cfm app.jar customManifest .where customManifest is the name of manifest file.

Note that the order of options is very important. If you use jat -cfm then the jar file name (value for -f option) should come before the manifest file name (value for -m option).

The option -C is discussed in a later example.