getting jar file version number
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: getting jar file version number

  1. #1
    Join Date
    Nov 2000
    Location
    Germany
    Posts
    645

    getting jar file version number

    Hi
    how to access an application server and get the version number of the jar files in that server ?
    I am beginner in java
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Belo Horizonte, Brazil
    Posts
    405

    Re: getting jar file version number

    Hello mohamed.

    To have access to the version of a jar file, you should have access to the jar file. Precisely, you need to take a look at the jar file's manifest (but not always a version is specififed).

    _______________________
    Is this post useful? If yes, I would appreciate if you rate it!

    Leandro T. C. Melo
    http://www.pazbrasil.org/

  3. #3
    Join Date
    Nov 2000
    Location
    Germany
    Posts
    645

    Re: getting jar file version number

    Hi
    Thanx for the reply

    is there way to get this version programmatically ?

    Regards

  4. #4
    Join Date
    Apr 2007
    Posts
    442

    Re: getting jar file version number

    Jar file is a zipped file. Basically you need to access it to get the files it contains, process the list of files untill you find manifest file, process that untill you come across version number.

    The link below is about compressed files handling. Might be usefull.

    http://www.javalobby.org/java/forums/t16299.html

  5. #5
    Join Date
    Jan 2006
    Location
    Belo Horizonte, Brazil
    Posts
    405

    Re: getting jar file version number

    Hello again.

    Quote Originally Posted by mohamed123
    is there way to get this version programmatically ?
    Once you have access to the jar file, you could try this:

    Code:
    JarFile jarfile = new JarFile("jarfile.jar");
    
    Manifest manifest = jarfile.getManifest();
    
    //Iterate over the manifest's entries looking for what you need.
    //Check out the Manifest class API.
    You just need to check the java docs for the Manifest class.

    _______________________
    Is this post useful? If yes, I would appreciate if you rate it!

    Leandro T. C. Melo
    http://www.pazbrasil.org/

  6. #6
    Join Date
    Apr 2007
    Posts
    442

    Re: getting jar file version number

    you are most correct. Far better to use the class for Jar Files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center