Java Jar Manifest createManifest()

Here you can find the source of createManifest()

Description

create Manifest

License

Apache License

Declaration

public static Manifest createManifest() 

Method Source Code

//package com.java2s;
/*/*  w w  w  . j a  v a  2s.  co m*/
 * #%L
 * SAMOA
 * %%
 * Copyright (C) 2013 Yahoo! Inc.
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import java.util.jar.Attributes;

import java.util.jar.Manifest;

public class Main {
    public static Manifest createManifest() {
        Manifest manifest = new Manifest();
        manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
        manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_URL, "http://samoa.yahoo.com");
        manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VERSION, "0.1");
        manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VENDOR, "Yahoo");
        manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VENDOR_ID, "SAMOA");
        Attributes s4Attributes = new Attributes();
        s4Attributes.putValue("S4-App-Class", "path.to.Class");
        Attributes.Name name = new Attributes.Name("S4-App-Class");
        Attributes.Name S4Version = new Attributes.Name("S4-Version");
        manifest.getMainAttributes().put(name, "samoa.topology.impl.DoTaskApp");
        manifest.getMainAttributes().put(S4Version, "0.6.0-incubating");
        return manifest;
    }
}

Related

  1. checkManifestForR(java.util.jar.JarFile jar)
  2. convertManifest(Manifest manifest)
  3. createManifest(Map customFields)
  4. createManifest(String manifestVerion, String mainClass, String jarInternalClasspath)
  5. createTestManifest(Attributes.Name name, String value)
  6. formatDisplay(String src, Manifest manifest)