code: protected ClassLoader getClassLoader()
      {
          final ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader();
          final List<URL> jarFileUrls = new ArrayList<>();
  
          if (libPath == null || libPath.length == 0)
          {
              return parentClassLoader;
          }
  
          for (String libPathEntry : libPath)
          {
              final File libDir = new File(libPathEntry);
              if (!libDir.isDirectory())
              {
                  continue;
              }
  
              final File[] jarFiles = libDir.listFiles(new FilenameFilter()
              {
                  public boolean accept(File dir, String name)
                  {
                      return name.endsWith(".jar");
                  }
              });
              if (jarFiles != null)
              {
  
                  for (File jarFile : jarFiles)
                  {
                      try
                      {
                          jarFileUrls.add(jarFile.toURI().toURL());
                      }
                      catch (MalformedURLException e)
                      {
                          // should not happen
                      }
                  }
              }
              else
              {
                  logger.error("Didn't find any jar files at " + libDir.getAbsolutePath());
              }
          }
  
          if (jarFileUrls.isEmpty())
          {
              return parentClassLoader;
          }
  
          return new URLClassLoader(jarFileUrls.toArray(new URL[jarFileUrls.size()]), parentClassLoader);
      }
docs: Returns the ClassLoader to use for the ScriptEngineManager. Adds all jar
  files in the "lib" subdirectory of the current directory to the class
  path. Override this method to provide your own ClassLoader.
  
  @return the ClassLoader to use for the ScriptEngineManager.
  @see #getScriptEngineManager()