How to write my own manifest for a Jar file

Discussion in 'Java' started by christian.bongiorno@gmail.com, Sep 21, 2005.

  1. Guest

    Can someone explain to me how it is that I can add values to a manifest
    (and subsequently add it to a jar file). I see the part where I can add
    it to the jar, but when I look at the Attributes class

    the toString() method is not overridded so I have no reason to believe
    that the toString() is properly formatted to be added to the
    Manifest(InputStream).

    it isn't serializable (so it can't go to an OutputStream directly)

    Manifest does not take an "Attributes" class as input anywhere I can
    see.

    So, without cheating and simply hand coding the manifest attributes
    strings, how do I tie the attributes in with the manifest?

    Is the idea to override the Attributes.toString() method and flush it
    to a ByteArrayInputStream()? I am missing the wisdom somewhere.

    Christian
    http://christian.bongiorno.org/resume.pdf
     
    , Sep 21, 2005
    #1
    1. Advertising

  2. wrote:
    > Can someone explain to me how it is that I can add values to a manifest
    > (and subsequently add it to a jar file). I see the part where I can add
    > it to the jar, but when I look at the Attributes class
    >
    > the toString() method is not overridded so I have no reason to believe
    > that the toString() is properly formatted to be added to the
    > Manifest(InputStream).


    I assume simply using the jar tool is out of the question? :)

    >
    > it isn't serializable (so it can't go to an OutputStream directly)


    Manifest has read() and write() methods.

    >
    > Manifest does not take an "Attributes" class as input anywhere I can
    > see.
    >
    > So, without cheating and simply hand coding the manifest attributes
    > strings, how do I tie the attributes in with the manifest?


    Manifest.getEntries() returns a Map of Strings to Attributes. It is not
    clear from the docs, but perhaps you are meant to add entries to the map?

    >
    > Is the idea to override the Attributes.toString() method and flush it
    > to a ByteArrayInputStream()? I am missing the wisdom somewhere.
    >
    > Christian
    > http://christian.bongiorno.org/resume.pdf
    >


    HTH,
    Ray

    --
    XML is the programmer's duct tape.
     
    Raymond DeCampo, Sep 25, 2005
    #2
    1. Advertising

  3. Roedy Green Guest

    On Sun, 25 Sep 2005 22:27:02 GMT, Raymond DeCampo
    <> wrote or quoted :

    >Manifest.getEntries() returns a Map of Strings to Attributes. It is not
    >clear from the docs, but perhaps you are meant to add entries to the map?


    if worst comes to worst, you can always revert to ZipFile and brethren
    where the manifest is just another member.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
     
    Roedy Green, Sep 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harpstein
    Replies:
    1
    Views:
    1,492
    Paul Beadle
    Oct 28, 2003
  2. hiwa
    Replies:
    3
    Views:
    8,444
    John C. Bollinger
    Jan 15, 2004
  3. Manish Hatwalne

    Reading manifest file from the jar file

    Manish Hatwalne, May 20, 2004, in forum: Java
    Replies:
    11
    Views:
    27,260
    tapas.adhikary
    May 14, 2009
  4. Tobias Merler
    Replies:
    0
    Views:
    411
    Tobias Merler
    Oct 9, 2004
  5. Replies:
    2
    Views:
    1,189
Loading...

Share This Page