File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jar and MANIFEST.MF

 
mark I thomas
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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):
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic