Java Code Examples for java.util.jar.Manifest#clear()
The following examples show how to use
java.util.jar.Manifest#clear() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BigJar.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 2
Source File: BigJar.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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; }
Example 3
Source File: BigJar.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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; }
Example 4
Source File: BigJar.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; }
Example 5
Source File: BigJar.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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; }
Example 6
Source File: BigJar.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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; }
Example 7
Source File: BigJar.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 8
Source File: BigJar.java From hottub with GNU General Public License v2.0 | 6 votes |
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; }
Example 9
Source File: BigJar.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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; }
Example 10
Source File: BigJar.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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; }
Example 11
Source File: BigJar.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 12
Source File: BigJar.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 13
Source File: BigJar.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 14
Source File: Installer.java From QuickTheories with Apache License 2.0 | 6 votes |
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); } }
Example 15
Source File: JarCreatingJarFinder.java From pitest with Apache License 2.0 | 6 votes |
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); } }