code: public static Set<String> getAllClasspathJars(final String... excludeEnv) {
  
      final Set<String> jars = new HashSet<>();
      final Set<Path> excludePaths = new HashSet<>();
  
      for (final String env : excludeEnv) {
        final String path = System.getenv(env);
        if (null != path) {
          final File file = new File(path);
          if (file.exists()) {
            excludePaths.add(file.toPath());
          }
        }
      }
  
      for (final String path : System.getProperty("java.class.path").split(File.pathSeparator)) {
        try {
          final File file = new File(path);
          if (file.exists()) {
            final Path absolutePath = file.toPath();
            boolean toBeAdded = true;
            for (final Path prefix : excludePaths) {
              if (absolutePath.startsWith(prefix)) {
                toBeAdded = false;
              }
            }
            if (toBeAdded) {
              jars.add(absolutePath.toString());
            }
          }
        } catch (final InvalidPathException ex) {
          LOG.log(Level.FINE, "Skip path: {0}: {1}", new Object[]{path, ex});
        }
      }
  
      return jars;
    }
docs: Get a set of all classpath entries EXCEPT of those under excludeEnv directories.
  Every excludeEnv entry is an environment variable name.
  
  @param excludeEnv A set of environments to be excluded.
  @return A set of classpath entries as strings.