public static Set<Path> getDirectoriesFromJar(Path pathToJarFile) throws IOException {
        Set<Path> result = new HashSet<Path>();
        ZipFile jarfile = new ZipFile(pathToJarFile.toFile());
        try {
            final Enumeration<? extends ZipEntry> entries = jarfile.entries();
            while (entries.hasMoreElements()) {
                ZipEntry entry = entries.nextElement();
                if (entry.isDirectory()) {
                    result.add(Paths.get(entry.getName()));
                }
            }
            jarfile.close();
        } finally {
            IOUtils.closeQuietly(jarfile);
        }
        return result;
    }
public static Set < Path > getDirectoriesFromJar ( Path pathToJarFile ) throws IOException { Set < Path > result = new HashSet < Path > ( ) ; ZipFile jarfile = new ZipFile ( pathToJarFile . toFile ( ) ) ; try { final Enumeration < ? extends ZipEntry > entries = jarfile . entries ( ) ; while ( entries . hasMoreElements ( ) ) { ZipEntry entry = entries . nextElement ( ) ; if ( entry . isDirectory ( ) ) { result . add ( Paths . get ( entry . getName ( ) ) ) ; } } jarfile . close ( ) ; } finally { IOUtils . closeQuietly ( jarfile ) ; } return result ; }
Get all of the directory paths in a zip/jar file
@param pathToJarFile location of the jarfile. can also be a zipfile
@return set of directory paths relative to the root of the jar