private void parseLibraryClassLoader() {
    if (null == libraryDir) {
      return;
    }

    Path libraryPath = Paths.get(libraryDir);
    if (Files.notExists(libraryPath) || !Files.isDirectory(libraryPath)) {
      return;
    }

    try {
      List<URI> jarUris = Files.list(libraryPath).filter(
          file -> file.toString().endsWith(".jar")).map(Path::toUri).collect(Collectors.toList());

      List<URL> jarUrls = new ArrayList<>(jarUris.size());
      for (URI jarUri : jarUris) {
        try {
          jarUrls.add(jarUri.toURL());
        } catch (MalformedURLException malformedURLException) {
          LOG.error("Unable to load the stack library {}", jarUri, malformedURLException);
        }
      }

      URL[] jarUrlArray = new URL[jarUris.size()];
      libraryClassLoader = new URLClassLoader(jarUrls.toArray(jarUrlArray),
          ClassUtils.getDefaultClassLoader());
    } catch (IOException ioException) {
      LOG.error("Unable to load libraries from {}", libraryPath, ioException);
    }
  }
Loads any classes found in the {@link #libraryDir} and creates a
{@link URLClassLoader} for them.
ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java