Here you can find the source of getManifest()
public static Manifest getManifest()
//package com.java2s; //License from project: Open Source License import java.util.jar.Manifest; import java.util.jar.Attributes; import java.util.Map; public class Main { public static Manifest getManifest() { Manifest manifest = new Manifest(); /* Add main attributes 1. Manifest Version//www .ja v a 2s. c o m 2. Main-Class 3. Sealed */ Attributes mainAttribs = manifest.getMainAttributes(); mainAttribs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); mainAttribs.put(Attributes.Name.MAIN_CLASS, "com.jdojo.archives.Test"); mainAttribs.put(Attributes.Name.SEALED, "true"); /* Add two individual sections */ /* Do not seal the com/jdojo/archives/ package. Note that you have sealed the whole JAR file and to exclude this package you we must add a Sealed: false attribute for this package separately. */ Map<String, Attributes> attribsMap = manifest.getEntries(); // Create an attribute "Sealed : false" and // add it for individual entry "Name: com/jdojo/archives/" Attributes a1 = getAttribute("Sealed", "false"); attribsMap.put("com/jdojo/archives/", a1); // Create an attribute "Content-Type: image/bmp" and // add it for images/logo.bmp Attributes a2 = getAttribute("Content-Type", "image/bmp"); attribsMap.put("images/logo.bmp", a2); return manifest; } public static Attributes getAttribute(String name, String value) { Attributes a = new Attributes(); Attributes.Name attribName = new Attributes.Name(name); a.put(attribName, value); return a; } }