public static ImmutableSet < File > findJarFiles ( ClassLoader first , ClassLoader ... rest ) throws IOException { Scanner scanner = new Scanner ( ) ; Map < URI , ClassLoader > map = Maps . newLinkedHashMap ( ) ; for ( ClassLoader classLoader : Lists . asList ( first , rest ) ) { map . putAll ( getClassPathEntries ( classLoader ) ) ; } for ( Map . Entry < URI , ClassLoader > entry : map . entrySet ( ) ) { scanner . scan ( entry . getKey ( ) , entry . getValue ( ) ) ; } return scanner . jarFiles ( ) ; }
Returns a list of jar files reachable from the given class loaders .