public static ZipEntry getClassZipEntryFromZipInClassPath ( String className ) throws IOException { String fileName = StringSupport . replaceAll ( className , "." , "/" ) ; fileName += ".class" ; Collection < String > jars = StringSupport . split ( System . getProperty ( "java.class.path" ) , ";:" , false ) ; for ( String jarFileName : jars ) { if ( jarFileName . endsWith ( ".jar" ) || jarFileName . endsWith ( ".zip" ) ) { ZipEntry entry = getZipEntryFromZip ( fileName , jarFileName ) ; if ( entry != null ) { return entry ; } } } return null ; }
Tries to retrieve a class as ZipEntry from all jars mentioned in system property java . class . path