如何从清单文件中读取版本?

我正在关注this article,“读取版本”部分,我想读取版本并在输出文件中添加一列,代码是这样的:

ExternalContext application = FacesContext.getcurrentInstance().getExternalContext();
InputStream inputStream = application.getResourceAsStream("/Meta-INF/MANIFEST.MF");
Manifest manifest = new Manifest(inputStream);

Attributes attributes = manifest.getMainAttributes();
String version = attributes.getvalue("Implementation-Version");

我对Java还是很陌生,不确定应该将这段代码放在哪里。

我试图创建一个函数,但是'ExternalContext','FacesContext'和'getResourceAsStream'以红色显示,有人可以帮忙吗?非常感谢。

guozili1983 回答:如何从清单文件中读取版本?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2979487.html

大家都在问