Code example for Manifest

Methods: getMainAttributes, write

0
            log.error("Could not extract the file", e);
        } finally { 
            jarFile.close();
        } 
 
        String dynamicImports = manifest.getMainAttributes().getValue("DynamicImport-Package");
        if (dynamicImports != null) {
            manifest.getMainAttributes().putValue("DynamicImport-Package",
                                                  dynamicImports + ",com.vladium.*");
        } else { 
            manifest.getMainAttributes().putValue("DynamicImport-Package", "com.vladium.*");
        } 
        File newManifest = new File(tempExtractedDir + File.separator + "META-INF" +
                                    File.separator + "MANIFEST.MF");
        FileOutputStream manifestOut = null;
        try { 
            manifestOut = new FileOutputStream(newManifest);
            manifest.write(manifestOut);
        } catch (IOException e) {
            log.error("Could not write content to new MANIFEST.MF file", e);
        } finally { 
            if (manifestOut != null) {
                manifestOut.close();