code: public static Attributes getAttributesForClass(final Class<?> clazz) throws IOException {
          // thanks to
          // http://stackoverflow.com/questions/1272648/need-to-read-own-jars-manifest-and-not-root-classloaders-manifest/1273432#1273432
          final String className = clazz.getSimpleName() + ".class";
          final String classPath = clazz.getResource(className).toString();
  
          final String type = classPath.contains(".war") ? ".war/" : ".jar/";
  
          final String manifestPath;
          if (classPath.startsWith("vfszip:")) {
              manifestPath = classPath.substring(0, classPath.lastIndexOf(type) + type.length()) + "META-INF/MANIFEST.MF";
          } else if (classPath.startsWith("vfs:")) {
              manifestPath = classPath.substring(0, classPath.lastIndexOf(type) + type.length()) + "META-INF/MANIFEST.MF";
          } else if (classPath.startsWith("jar:")) {
              manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + "!".length()) + "/META-INF/MANIFEST.MF";
          } else {
              return null;
          }
  
  
          InputStream is = null;
          try {
              is = new URL(manifestPath).openStream();
              final Manifest manifest = new Manifest(is);
              return manifest.getMainAttributes();
          } finally {
              if (is != null) {
                  is.close();
              }
          }
      }
docs: Get the Manifest Attributes from a JAR Archive for a specific class.
  <p/>
  Thanks to the Zanata Team for this method, it has just been edited for this libraries needs.
  
  @param clazz The class to find the version information for.
  @return The Attributes that exist in the Jars Manifest for the specified class.
  @throws MalformedURLException
  @throws IOException