code: public static void addURL(URL u) throws IOException {
          if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) {
              return;
          }
  
          URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
          URL[] urls = sysLoader.getURLs();
          for (int i = 0; i < urls.length; i++) {
              if (StringUtils.equalsIgnoreCase(urls[i].toString(), u.toString())) {
                  if (log.isDebugEnabled()) {
                      log.debug("URL " + u + " is already in the CLASSPATH");
                  }
                  return;
              }
          }
          Class<URLClassLoader> sysclass = URLClassLoader.class;
          try {
              Method method = sysclass.getDeclaredMethod("addURL", parameters);
              method.setAccessible(true);
              method.invoke(sysLoader, new Object[]{u});
          } catch (Throwable t) {
              t.printStackTrace();
              throw new IOException("Error, could not add URL to system classloader");
          }
      }
docs: Add URL to CLASSPATH
  @param u URL
  @throws IOException IOException