在插件工程中,可以通过Bundle
代码如下:
1.获取到MANIFEST
URL url = Activator.getDefault().getBundle().getResource("META-INF/MANIFEST.MF");
URL fileUrl = FileLocator.toFileURL(url));
2.解析
Manifest mf = new Manifest(InputStream);//InputStream 自己获取
Attributes attributes = mf.getMainAttributes();
//以下就是获取最终的value
String publishTime = attributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
补充:
从jar中直接获取MANIFEST方法
JarFile jf = new JarFile(newJarPath);
Manifest mf = jf.getManifest();//同样可以获取mmanifest对象
以下同2
rcp(插件开发) 插件中如何获取MANIFEST.MF 文件,并解析?,布布扣,bubuko.com
rcp(插件开发) 插件中如何获取MANIFEST.MF 文件,并解析?
原文:http://blog.csdn.net/soszou/article/details/20709457