code: public static String getAPIVersion(final String resourceFileName, final String versionProperty) {
          final Properties props = new Properties();
          final URL url = ClassLoader.getSystemResource(resourceFileName);
          if (url != null) {
              InputStream is = null;
              try {
                  is = url.openStream();
                  props.load(is);
              } catch (IOException ex) {
                  LOG.debug("Unable to open resource file", ex);
              } finally {
                  if (is != null) {
                      try {
                          is.close();
                      } catch (IOException e) {
  
                      }
                  }
              }
          }
  
          String version = props.getProperty(versionProperty, "unknown");
  
          return version;
      }
docs: Get the Version Number from a properties file in the Application Classpath.
  
  @param resourceFileName The name of the properties file.
  @param versionProperty  The name of the version property in the properties file.
  @return The Version number or "unknown" if the version couldn't be found.