File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes jar and MANIFEST.MF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "jar and MANIFEST.MF" Watch "jar and MANIFEST.MF" New topic


mark I thomas
Ranch Hand

Joined: Apr 07, 2008
Posts: 86
I have a folder that contains all the classes and META-INF. Here is the subfolders

com (includes its subfolders that contain .class files)

I used ant

<jar jarfile="myapp.jar"

to create a "myapp.jar" file. The jar was successfully generated. However, when I do

"jar -xvf myapp.jar" to unpack it, I saw the META-INF/ folder and its MANIFEST.MF fiel. The MANIFEST.MF is different from the original MANIFEST.MF I used for packing.

Do you know why and how I can ensure the MANIFESTY.MF is not changed ?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The proper way to add a manifest is not to have a file in a META-INF directory, but to specify the file in a manifest attribute. The file can be anywhere and be named anything; Ant will package it properly.

Even better, you can keep the meta information in the build file (if you want):
I agree. Here's the link:
subject: jar and MANIFEST.MF
It's not a secret anymore!