jar file

 

The most common command to make a new jar file users the following syntax:

Jar cvf JARFileName File1 File2...

Jar cvfm jarname manifest.mf class1 class2

The option:

-c  create new archive file

-t  list archive file

-x  Extract the archived specified (or all) files

-u  update an existing jar file

-v  In the standard output to generate verbose output

-f  Specify the archive file name

-m  The list of files that contain a specified list of information

-e  Bundled into the executable jar file for the separate applications

     Specify the application entry point

-0  Only storage; do not use any ZIP compression

-M  Does not create entries in the list of documents

-i  generate index info for Specify a jar file

-C  update to specify dictionary and content it file

The Manifest:

Is called MANIFEST.MF and is located in a special META-INF subdirectory of the jar file

The minimum legal manifest is quite boring –just   Manifest-Version: 1.0

 

Complex manifests can have many more entries. The manifest entries are grouped into sections . the first ection in the manifest is calld the main section. It applies to the whole JAR fiile .Subsequent entries can specify properties of named entites such as in dividual  files ,package ,or URLs. Those entries must begin with  a Name entry.Seciton are separated by blank lines.For example:

     Manifest-Version: 1.0

Lines describing this archive

 

Name:Woozle.class

Lines describing this file

Sealing

       The manifest like this:

       Name: aken/xml/

       Sealed: true

      

       Name: aken1/xml/

       Sealed: false

Packaging Beans in JAR Files

Pattern:

Manifest-Version: 1.0

 

Name: com/horstmann/corejava/ImageViewerBean.class

Java-Bean: True

 

We place our example beans into the package com.horstmann.corejava because some builder environments have problems loading beans from the default package.

If your bean contains multiple class files, you just mention in the manifest those class files that are beans and that you want to have displayed in the toolbox. For example, you could place ImageViewerBean and FileNameBean into the same JAR file and use the manifest

Manifest-Version: 1.0
 
Name: com/horstmann/corejava/ImageViewerBean.class
Java-Bean: True
 
Name: com/horstmann/corejava/FileNameBean.class
Java-Bean: True

Make sure that there are no spaces after the ends of each line, that there are blank lines after the version and between bean entries, and that the last line ends in a newline.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值