private static List<Class<?>> getMainClasses(
            List<String> classNames) {
        List<Class<?>> classes = new ArrayList<>();
        Class<?> c = null;
        for (String className : classNames) {
            try {
                c = Class.forName(className);
            }
            catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
            if (c != null && isMainClass(c)) {
                classes.add(c);
            }
        }
        return classes;
    }