private void scanJarManifestForClassPathEntries ( LinkedList < WorkListItem > workList , ICodeBase codeBase ) throws IOException { // See if this codebase has a jar manifest ICodeBaseEntry manifestEntry = codeBase . lookupResource ( "META-INF/MANIFEST.MF" ) ; if ( manifestEntry == null ) { // Do nothing - no Jar manifest found return ; } // Try to read the manifest InputStream in = null ; try { in = manifestEntry . openResource ( ) ; Manifest manifest = new Manifest ( in ) ; Attributes mainAttrs = manifest . getMainAttributes ( ) ; String classPath = mainAttrs . getValue ( "Class-Path" ) ; if ( classPath != null ) { String [ ] pathList = classPath . split ( "\\s+" ) ; for ( String path : pathList ) { // Create a codebase locator for the classpath entry // relative to the codebase in which we discovered the Jar // manifest ICodeBaseLocator relativeCodeBaseLocator = codeBase . getCodeBaseLocator ( ) . createRelativeCodeBaseLocator ( path ) ; // Codebases found in Class-Path entries are always // added to the aux classpath, not the application. addToWorkList ( workList , new WorkListItem ( relativeCodeBaseLocator , false , ICodeBase . Discovered . IN_JAR_MANIFEST ) ) ; } } } finally { if ( in != null ) { IO . close ( in ) ; } } }
Check a codebase for a Jar manifest to examine for Class - Path entries .