加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

Java清单文件中的行顺序

发布时间:2020-12-15 01:00:55 所属栏目:Java 来源:网络整理
导读:清单文件中的行顺序是否重要? 有人试图说服我,当清单文件发生变化时,事情就会破坏 Manifest-Version: 1.0 Class-Path: xxx.jar Main-Class: com.something 至 Manifest-Version: 1.0 Main-Class: com.somethingClass-Path: xxx.jar (Main-Class和Class-Path
清单文件中的行顺序是否重要?

有人试图说服我,当清单文件发生变化时,事情就会破坏

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.

在内部,清单由HashMap表示,HashMap是无序数据结构.如果你想仔细看看,这是源代码java.util.jar.Manifest.

> http://www.massapi.com/source/jdk1.6.0_17/src/java/util/jar/Manifest.java.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读