如何使用命令打jar文件

把位于C盘目录下的WebTest目录下的目录和文件打成.war文件,并在打jar的同时指明.war文件存放的位置,即c:/JClass/。要注意的是参数-C中的C必须是大写的,如果想把当前目录下的目录和文件打下war或jar文件,则去掉参数-C和其后的路径,若想把jar或war文件也想放在当前目录下,则cvf后直接跟.war文件的文件名。

jar cvf c:/JClass/test.war/jar -C c:/WebTest .
把目录c/WebTest目录的文件和目录打成.war文件并放在C:/JClass/目录下,后面必须跟一个“.”来指明是c:/WebTest目录下的文件和目录被打成.jar或.war文件

jar cvf c:/JClass/test.war
即把当前目录下的目录和文件打成.war文件并放在c:/JClass/目录下。

jar cvf test.war 即把当前目录下的文件和目录放在当前目录下。


jar tvf c:/JClass/test.war


基本操作命令:

    创建jar文件

    jar cf jar-file input-file(s)

    c---want to Create a JAR file.
         f---want the output to go to a file rather than to stdout.
    eg: 1)jar cf myjar.jar query_maintain_insert.htm
        2)jar cvf myjar.jar query_maintain_insert.htm
        v---Produces verbose(详细的) output.
        3)jar cvf myjar.jar query_maintain_insert.htm mydirectory
        4)jar cv0f myjar.jar query_maintain_insert.htm mydirectory
        0---don't want the JAR file to be compressed.
        5)jar cmf MANIFEST.MF myjar.jar yahh.txt
        m---Used to include manifest information from an existing manifest file.
        6)jar cMf MANIFEST.MF myjar.jar yahh.txt
        M---the default manifest file should not be produced.
        7)jar cvf myjar.jar *
        *---create all contents in current directory.
   察看jar文件
jar tf jar-file
t---want to view the Table of contents of the JAR file.
eg: 1)jar vft yahh.jar
v---Produces verbose(详细的) output.
3. 提取jar文件
jar xf jar-file [archived-file(s)]
x---want to extract files from the JAR archive.
eg: 1)jar xf yahh.jar yahh.txt(仅提取文件yahh.txt)
2)jar xf yahh.jar alex/yahhalex.txt(仅提取目录alex下的文件yahhalex.txt)
3)jar xf yahh.jar(提取该jar包中的所有文件或目录)
4. 修改Manifest文件
jar cmf manifest-addition jar-file input-file(s)
m---Used to include manifest information from an existing manifest file.
5. 更新jar文件
jar uf jar-file input-file(s)
u---want to update an existing JAR file.  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值