Skip to content

Instantly share code, notes, and snippets.

@halyph
Created June 27, 2012 16:07
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halyph/3005083 to your computer and use it in GitHub Desktop.
Save halyph/3005083 to your computer and use it in GitHub Desktop.
Read META-INF/MANIFEST.MF from jar file #java #manifest #read
Manifest mf = new Manifest();
mf.read(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/MANIFEST.MF"));
Attributes atts = mf.getMainAttributes();
System.out.println("Version: " + atts.getValue("Implementation-Version"));
System.out.println("Build: " + atts.getValue("Implementation-Build"));
@shubhambansal500
Copy link

this is a great answer but what if there are thousands of jars?

@peduz
Copy link

peduz commented Jul 11, 2018

Two jars are more then enough!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment