manifest笔记

  manifest:名单。
  官方网站:http://java.sun.com/docs/books/tutorial/jar/manifest/index.html
  
   JAR files support a wide range of functionality, including electronic signing, version control, package sealing, and others. What gives a JAR file this versatility? The answer is the JAR file's manifest.
  
   The manifest is a special file that can contain information about the files packaged in a JAR file. By tailoring this "meta" information that the manifest contains, you enable the JAR file to serve a variety of purposes.
  JAR文件提供了丰富的功能,包括电子签名、版本控制、包屏蔽(密封)和其他等等。谁让JAR文件具有如此多功能。答案是JAR文件的manifest.
  manifest指定了关于被包进JAR的一些文件的信息。通过manifest包含的这些静态信息,你可以使JAR文件提供多种效果。
  
  下面我简单介绍一下manifest的使用:
  1、当你创建JAR时,系统会自动建立manifest文件。manifest文件在一个压缩包中是唯一的,路径是META-INF/MANIFEST.MF。
  默认内容:
  Manifest-Version: 1.0
  Created-By: 1.5.0_01 (Sun Microsystems Inc.)

  
  2、manifest文件使用文本编辑工具编写。
  添加manifest的基本命令:
  jar cmf manifest-addition jar-file input-file(s)
  
  3、如果你有一个绑定JAR的应用,您需要指定一个Main-Class: classname。
  Main-Class: MyPackage.MyClass
  
  4、引用JAR文件外的JAR
  Class-Path: jar1-name jar2-name directory-name/jar3-name
  
  5、设置package的版本信息
  例如:
  Name: java/util/
  Specification-Title: Java Utility Classes
  Specification-Version: 1.2
  Specification-Vendor: Sun Microsystems, Inc.
  Implementation-Title: java.util
  Implementation-Version: build57
  Implementation-Vendor: Sun Microsystems, Inc.
  
  6、屏蔽JAR内的一些package
  例如:
  Name: myCompany/myPackage/
  Sealed: true
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值