class ClassPaths {

    public static List<String> getClassPathEntries(String classPath) {
        List<String> entries = new ArrayList<>();
        // If the classpath is empty, return an empty list
        if(classPath.isEmpty()){
            return entries;
        }
        // Else process entries
        for(String rawEntry : classPath.split(File.pathSeparator)) {
            File file = new File(rawEntry);
            // Check that the entry exists, otherwise skip it
            if(file.exists()) {
                // If the entry is a folder, check for '.jar' files
                if(file.isDirectory()) {
                    // Add jar files to the classpath entries
                    for(File jarFile : file.listFiles((File f) -> f.isFile() && f.getName().endsWith(".jar"))) {
                        entries.add(jarFile.getAbsolutePath());
                    }
                }
                // Add the entry itself
                entries.add(file.getAbsolutePath());
            } else {
                LOG.warn("ClassPath entry {} not found, will skip it.", rawEntry);
            }
        }
        return entries;
    }

}