java.util.jar.Manifest#clear ( )源码实例Demo

下面列出了java.util.jar.Manifest#clear ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码2 项目: TencentKona-8   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码3 项目: jdk8u60   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码4 项目: openjdk-jdk8u   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码6 项目: openjdk-jdk9   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码7 项目: jdk8u-jdk   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码8 项目: hottub   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码9 项目: openjdk-8-source   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码10 项目: openjdk-8   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码11 项目: jdk8u_jdk   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码12 项目: jdk8u-jdk   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码13 项目: jdk8u-dev-jdk   文件: BigJar.java
Manifest createMainClass(File javaFile) throws IOException {
    javaFile.delete();
    List<String> content = new ArrayList<>();
    content.add("public class " + baseName(javaFile) + "{");
    content.add("public static void main(String... args) {");
    content.add("System.out.println(\"Hello World\\n\");");
    content.add("System.exit(0);");
    content.add("}");
    content.add("}");
    createFile(javaFile, content);
    compile(javaFile.getName());
    Manifest manifest = new Manifest();
    manifest.clear();
    manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, baseName(javaFile));
    System.out.println(manifest.getMainAttributes().keySet());
    System.out.println(manifest.getMainAttributes().values());
    return manifest;
}
 
源代码14 项目: QuickTheories   文件: Installer.java
private void createJarFromClassPathResources(final FileOutputStream fos,
    final String location) throws IOException {
  final Manifest m = new Manifest();

  m.clear();
  final Attributes global = m.getMainAttributes();
  if (global.getValue(Attributes.Name.MANIFEST_VERSION) == null) {
    global.put(Attributes.Name.MANIFEST_VERSION, "1.0");
  }
  final File mylocation = new File(location);
  global.putValue(BOOT_CLASSPATH, getBootClassPath(mylocation));
  global.putValue(PREMAIN_CLASS, AGENT_CLASS_NAME);
  global.putValue(AGENT_CLASS, AGENT_CLASS_NAME);    
  global.putValue(CAN_REDEFINE_CLASSES, "true");
  global.putValue(CAN_RETRANSFORM_CLASSES, "true");
  global.putValue(CAN_SET_NATIVE_METHOD, "true");

  try(JarOutputStream jos = new JarOutputStream(fos, m)) {
    addClass(Agent.class, jos);
    addClass(CodeCoverageStore.class, jos);
    addClass(InvokeReceiver.class, jos);
  }
}
 
源代码15 项目: pitest   文件: JarCreatingJarFinder.java
private void createJarFromClassPathResources(final FileOutputStream fos,
    final String location) throws IOException {
  final Manifest m = new Manifest();

  m.clear();
  final Attributes global = m.getMainAttributes();
  if (global.getValue(Attributes.Name.MANIFEST_VERSION) == null) {
    global.put(Attributes.Name.MANIFEST_VERSION, "1.0");
  }
  final File mylocation = new File(location);
  global.putValue(BOOT_CLASSPATH, getBootClassPath(mylocation));
  global.putValue(PREMAIN_CLASS, AGENT_CLASS_NAME);
  global.putValue(CAN_REDEFINE_CLASSES, "true");
  global.putValue(CAN_SET_NATIVE_METHOD, "true");

  try (JarOutputStream jos = new JarOutputStream(fos, m)) {
    addClass(HotSwapAgent.class, jos);
    addClass(CodeCoverageStore.class, jos);
    addClass(InvokeReceiver.class, jos);
  }
}