Created
November 21, 2019 07:41
-
-
Save liviutudor/cf401cdb44eaf534c10d08266a351048 to your computer and use it in GitHub Desktop.
How to read own manifest file and get version number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URLClassLoader cl = (URLClassLoader) App.class.getClassLoader(); | |
URL url = cl.findResource("META-INF/MANIFEST.MF"); | |
Manifest manifest = new Manifest(url.openStream()); | |
Attributes attr = manifest.getMainAttributes()); | |
System.out.println(manifest.getMainAttributes().getValue("Implementation-Title")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment