public static ClassLoader addToClassPath(ClassLoader cloader, String[] newPaths) throws Exception {
    List<URL> curPath = getCurrentClassPaths(cloader);

    for (String onestr : newPaths) {
      URL oneurl = urlFromPathString(onestr);
      if (oneurl != null && !curPath.contains(oneurl)) {
        curPath.add(oneurl);
      }
    }

    return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
      @Override
      public ClassLoader run() {
        return new URLClassLoader(curPath.toArray(new URL[0]), cloader);
      }
    });
  }
Add new elements to the classpath.

@param newPaths
         Array of classpath elements
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreUtils.java