首页 > 其他 > 详细

rcp(插件开发) 插件中如何获取MANIFEST.MF 文件,并解析?

时间:2014-03-08 06:00:10      阅读:469      评论:0      收藏:0      [点我收藏+]

在插件工程中,可以通过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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!