class JVMUtil {

    public static String[] addAllJarsToClassPath(String dirName) {
        if (!FileUtil.isDirectory(dirName)) {
            return null;
        }

        File dir = new File(dirName);
        List<String> ret = CollectionUtil.createArrayList();

        File[] files = dir.listFiles();
        for (File file : files) {
            if (file.isDirectory()) {
                ret.addAll(Arrays.asList(addAllJarsToClassPath(file.getAbsolutePath())));
                continue;
            }

            if (file.getName().toLowerCase().endsWith(".jar") && appendToClassPath(file.getAbsolutePath())) {
                ret.add(file.getAbsolutePath());
            }
        }

        return ret.toArray(new String[0]);
    }

}