java - Java list 文件中行的顺序

标签 java manifest

list 文件中行的顺序重要吗?

有人试图说服我,当 list 文件从

Manifest-Version: 1.0 
Class-Path: xxx.jar 
Main-Class: com.something

Manifest-Version: 1.0 
Main-Class: com.something
Class-Path: xxx.jar

(Main-Class 和 Class-Path 行颠倒了。)

最佳答案

不,这两行的顺序无关紧要。

这是来自 the documentation 的引述:

...

  • Versions:

    Manifest-Version and Signature-Version must be first, and in exactly that case (so that they can be recognized easily as magic strings). Other than that, the order of attributes within a main section is not significant.

  • Ordering:

    The order of individual manifest entries is not significant.

...

在内部, list 由 HashMap 表示,它是一种无序的数据结构。如果您想仔细查看,这里是源代码 java.util.jar.Manifest

关于java - Java list 文件中行的顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7145790/

相关文章:

java - 如何更改Eclipse提取方法模板?

java - 如何在 Java Web 应用程序中共享相同的静态数据对象?

google-chrome - chrome APP : google maps, 拒绝加载脚本,因为它违反了以下内容安全策略指令

java - 导出项目jar文件中的jdbc

java - 通过命令提示符在java中制作 list 文件

java - 在 php 中使用 js api 使用 Evercookie 创建 cookie 时出现问题

java - 发生异常后如何关闭 BufferedReader?

.net - “Activation context generation failed”投诉试图添加应用程序 list

java - 解析外部依赖的类路径

Java Swing 处理透明度和图像的图形故障