如何在jar中验证MANIFEST.MF的顺序? [英] How do I verify the order of MANIFEST.MF within jar?

查看:119
本文介绍了如何在jar中验证MANIFEST.MF的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个对我来说绝对新鲜的有趣问题。正如我突然发现的那样,Jar规范说,包括在内, META-INF MANIFEST.MF 必须是 *。jar 包的第一个和第二个条目,而不仅仅是归档中的目录和文件。

I've run into interesting problem which is absolutely new to me. As I've suddenly discovered, Jar specification says that, being included, META-INF and MANIFEST.MF must be first and second entries of *.jar package and not just directory and file within archive.

我正在工作Java框架非常注意这个要求而不是那么冗长。如何在jar中正确订购 META-INF MANIFEST.MF

I'm working with Java framework being very watchful about this requirement and not as much verbose. How do I check that META-INF and MANIFEST.MF are properly ordered within jar?

更新:
许多罐子都是第三方,其中有很多。我无法在记事本,excel,hexeditor,photoshop或任何寻找字节序列的东西中打开这些罐子。我需要命令行工具。谢谢!

UPDATE: Many of jars are third-party, and there are many of them. I'm not able to open these jars in notepad, excel, hexeditor, photoshop or whatever looking for byte sequences. I need command-line tool. Thanks!

更新2:
以下是我提出这个问题的原因:
http://www.mail-archive.com/dev@felix.apache。 org / msg17097.html

推荐答案

以下命令将按顺序列出JAR的内容:

The following command will list the contents of a JAR in order:

jar tf foo.jar

请注意,JAR规范中没有实际要求首先出现 META-INF / MANIFEST.MF 。但是,由 jar 工具(随JDK提供)执行构建的JAR首先具有清单,因此它已成为惯例。

Note that there is no actual requirement in the JAR specification for META-INF/MANIFEST.MF to appear first. However JARs built by the jar tool (supplied with the JDK) do have the manifest first, and therefore it has become a convention.

这篇关于如何在jar中验证MANIFEST.MF的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆