public static Manifest readManifestFromExternalJar(File jarFile) {
        if (!jarFile.getName().endsWith(".jar")) {
            throw new IllegalArgumentException("not jar file : " + jarFile);
        }
        InputStream in = null;
        String urlStr = "jar:file:" + jarFile.getAbsolutePath() + "!/META-INF/MANIFEST.MF";
          try {
            URL inputURL = new URL(urlStr);
            JarURLConnection conn = (JarURLConnection) inputURL.openConnection();
            in = conn.getInputStream();
            return new Manifest(in);
          } catch (FileNotFoundException e) {
              return null;
          } catch (IOException e) {
              throw new RuntimeException(e);
          } finally {
              IOUtils.closeQuietly(in);
          }
    }
public static Manifest readManifestFromExternalJar ( File jarFile ) { if ( ! jarFile . getName ( ) . endsWith ( ".jar" ) ) { throw new IllegalArgumentException ( "not jar file : " + jarFile ) ; } InputStream in = null ; String urlStr = "jar:file:" + jarFile . getAbsolutePath ( ) + "!/META-INF/MANIFEST.MF" ; try { URL inputURL = new URL ( urlStr ) ; JarURLConnection conn = ( JarURLConnection ) inputURL . openConnection ( ) ; in = conn . getInputStream ( ) ; return new Manifest ( in ) ; } catch ( FileNotFoundException e ) { return null ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } finally { IOUtils . closeQuietly ( in ) ; } }
returns null if no manifest found