This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "jar and MANIFEST.MF" Watch "jar and MANIFEST.MF" New topic
Author

jar and MANIFEST.MF

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)
META-INF/MANIFEST.MF

I used ant

<jar jarfile="myapp.jar"
basedir="."/>

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
Marshal

Joined: Mar 22, 2005
Posts: 41586
    
  54
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):


Ping & DNS - my free Android networking tools app
 
Consider Paul's rocket mass heater.
 
subject: jar and MANIFEST.MF