Getting "my" version information from a manifest file.

Discussion in 'Java' started by GB, Jan 21, 2005.

  1. GB

    GB Guest

    Can someone help & point out why this doesn't work please?

    I have written a manifest file which contains;

    Manifest-version: 1.0

    Name: com/xyz/mylib/
    Implementation-Title: com.xyz.mylib
    Implementation-Version: 42
    Implementation-Vendor: My Co

    This is placed in the file manifest.mf in the META-INF directory in my jar.

    But when I do this;

    Package version_info = Package.getPackage("com.xyz.mylib");
    String revision = version_info.getImplementationVersion();

    revision is always set as null.

    If I substitute "com.xyz.mylib" for "org.apache.log4j" (log4j being
    one of the jars I use) then this works and I get revision set to
    "1.2.8".

    What have I missed?
     
    GB, Jan 21, 2005
    #1
    1. Advertising

  2. Try removing the blank line after "Manifest-Version: 1.0" . I removed the blank line from
    your example and it worked.


    Hope this helps,

    R. Kevin Cole


    (GB) wrote:

    >Can someone help & point out why this doesn't work please?
    >
    >I have written a manifest file which contains;
    >
    >Manifest-version: 1.0
    >
    >Name: com/xyz/mylib/
    >Implementation-Title: com.xyz.mylib
    >Implementation-Version: 42
    >Implementation-Vendor: My Co
    >
    >This is placed in the file manifest.mf in the META-INF directory in my jar.
    >
    >But when I do this;
    >
    > Package version_info = Package.getPackage("com.xyz.mylib");
    > String revision = version_info.getImplementationVersion();
    >
    >revision is always set as null.
    >
    >If I substitute "com.xyz.mylib" for "org.apache.log4j" (log4j being
    >one of the jars I use) then this works and I get revision set to
    >"1.2.8".
    >
    >What have I missed?
     
    R. Kevin Cole, Jan 21, 2005
    #2
    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. thebad1
    Replies:
    3
    Views:
    1,720
    thebad1
    Feb 2, 2007
  2. Brian Herbert Withun
    Replies:
    3
    Views:
    1,242
    Mark Space
    Dec 11, 2007
  3. V Green
    Replies:
    0
    Views:
    885
    V Green
    Feb 5, 2008
  4. PA Bear [MS MVP]
    Replies:
    0
    Views:
    1,000
    PA Bear [MS MVP]
    Feb 5, 2008
  5. Andrew Thompson
    Replies:
    4
    Views:
    366
    Andrew Thompson
    Dec 13, 2008
Loading...

Share This Page