static public String getManifestVersionNumber(File file) throws IOException {
        JarFile jar = new JarFile(file);
        Manifest manifest = jar.getManifest();
        String versionNumber = null;
        java.util.jar.Attributes attributes = manifest.getMainAttributes();
        if (attributes!=null) {
            Iterator it = attributes.keySet().iterator();
            while (it.hasNext()) {
                Attributes.Name key = (Attributes.Name)it.next();
                String keyword = key.toString();
                if (keyword.equals("Implementation-Version") || keyword.equals("Bundle-Version")){
                    versionNumber = (String)attributes.get(key);
                    break;
                }
            }
        }
        jar.close();
        
        if (versionNumber == null || versionNumber.equals("")) {
            return null;
        }

        return versionNumber;
    }
static public String getManifestVersionNumber(File file) throws IOException {
        JarFile jar = new JarFile(file);
        Manifest manifest = jar.getManifest();
        String versionNumber = null;
        java.util.jar.Attributes attributes = manifest.getMainAttributes();
        if (attributes!=null) {
            Iterator it = attributes.keySet().iterator();
            while (it.hasNext()) {
                Attributes.Name key = (Attributes.Name)it.next();
                String keyword = key.toString();
                if (keyword.equals("Implementation-Version") || keyword.equals("Bundle-Version")){
                    versionNumber = (String)attributes.get(key);
                    break;
                }
            }
        }
        jar.close();
        
        if (versionNumber == null || versionNumber.equals("")) {
            return null;
        }

        return versionNumber;
    }
static public String getManifestVersionNumber ( File file ) throws IOException { JarFile jar = new JarFile ( file ) ; Manifest manifest = jar . getManifest ( ) ; String versionNumber = null ; java . util . jar . Attributes attributes = manifest . getMainAttributes ( ) ; if ( attributes != null ) { Iterator it = attributes . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Attributes . Name key = ( Attributes . Name ) it . next ( ) ; String keyword = key . toString ( ) ; if ( keyword . equals ( "Implementation-Version" ) || keyword . equals ( "Bundle-Version" ) ) { versionNumber = ( String ) attributes . get ( key ) ; break ; } } } jar . close ( ) ; if ( versionNumber == null || versionNumber . equals ( "" ) ) { return null ; } return versionNumber ; }
e.g. /drivers/h2/h2-1.3.162.jar
e . g . / drivers / h2 / h2 - 1 . 3 . 162 . jar