Java Jar Manifest getManifest(String className)

Here you can find the source of getManifest(String className)

Description

Return a Manifest which indicate the parameter as the class containing the main of the application.

License

Open Source License

Parameter

Parameter Description
className name of the class containing the main of the application. If the class is "Main.class" in the package "org.main", then the className is "org.main.Main".

Return

Manifest which indicate the main

Declaration


public static Manifest getManifest(String className) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.jar.Manifest;
import java.util.jar.Attributes;

public class Main {
    /**//from w w  w . ja va2 s. c  o  m
    *Return a Manifest which indicate the parameter as the class containing the main of the application.
    *@param className name of the class containing the main of the application. If the class is "Main.class" in the package "org.main", then the className is "org.main.Main".
    *@return Manifest which indicate the main
    */

    public static Manifest getManifest(String className) {
        Manifest mf = new Manifest();
        mf.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
        mf.getMainAttributes().put(new Attributes.Name("Built-By"), "Sonet Nicolas");
        mf.getMainAttributes().put(new Attributes.Name("Created-By"), "Sonet Nicolas");
        mf.getMainAttributes().put(Attributes.Name.MAIN_CLASS, className);
        return mf;
    }
}

Related

  1. getManifest(File in)
  2. getManifest(File jarFile)
  3. getManifest(File pluginFile)
  4. getManifest(final String jarFileName)
  5. getManifest(JarFile pluginJarFile)
  6. getManifest(String path)
  7. getManifest(ZipFile zip)
  8. getManifest(ZipFile zipFile)
  9. getManifestAttribute(InputStream in, String attr)