MANIFEST.MF文件可以用
Manifest类读取:
Manifest manifest = new Manifest(new FileInputStream(new File("MANIFEST.MF")));
然后你可以通过做所有的输入
Map entries = manifest.getEntries();
和所有主要的属性做
Attributes attr = manifest.getMainAttributes();
一个工作的例子
我的MANIFEST.MF文件是这样的:
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
我的代码:
Manifest manifest = new Manifest(new FileInputStream(new File("MANIFEST.MF")));
Attributes attr = manifest.getMainAttributes();
System.out.println(attr.getValue("Manifest-Version"));
System.out.println(attr.getValue("X-COMMENT"));
输出:
1.0
Main-Class will be added automatically by build