jar-The Java Archive Tool

遇到的问题-----The project contains another dependency with the same archive name maven工程有报错如下: Invalid classpath publish/export dependency D:/myeclipse/Common/binary/com.sun.java.jdk.win32.x86_64_1.6.0.013/lib/tools.jar. The project contains another dependency with the same a 阅读详情

jar-The Java Archive Tool

Combines multiple files into a single JAR archive file.

SYNOPSIS

jar [ options ] [manifest] destination input-file [input-files]

DESCRIPTION

The jar tool is a java application that combines multiple files into a single JAR archive file. jar is a general-purpose archiving and compression tool, based on ZIP and the ZLIB compression format. However, jar was designed mainly to facilitate the packaging of java applets or applications into a single archive. When the components of an applet or application (.class files, images and sounds) are combined into a single archive, they may be downloaded by a java agent (like a browser) in a single HTTP transaction, rather than requiring a new connection for each piece. This dramatically improves download times. <!-- REMIND: put a link to download benchmark statistics in here --> jar also compresses files and so further improves download time. In addition, it allows individual entries in a file to be signed by the applet author so that their origin can be authenticated. The syntax for the jar tool is almost identical to the syntax for the tar command.

The 3 types of input files for the jar tool are

  • manifest file (optional)
  • destination jar file
  • files to be archived

Typical usage is

	% jar cf myjarfile *.class 
In this example, all the class files in the current directory are placed into the file named "myjarfile". A manifest file is automatically generated by the jar tool and is always the first entry in the jar file. By default, it is named META-INF/MANIFEST.INF. The manifest file is the place where any meta-information about the archive is stored. Refer to the manifest specification for details about how meta-information is stored in the manifest file.

If you have a pre-existing manifest file that you want the jar tool to use for the new jar archive, you can specify it using the -m option:

	% jar cmf myManifestFile myJarFile *.class

When files are added to a jar archive, the file and its MD5 and SHA hashes are stored. The hashes are entered into the manifest file. It is easy to view and process the contents of the manifest file, since it uses RFC822 ascii format.

OPTIONS

c
Creates a new or empty archive on the standard output.

t
Lists the table of contents from standard output.

x file
Extracts all files, or just the named files, from standard input. If file is omitted, then all files are extracted; otherwise, only the specified file or files are extracted.

f
The second argument specifies a jar file to process. In the case of creation, this refers to the name of the jar file to be created (instead of on stdout). For table or xtract, the second argument identifies the jar file to be listed or extracted.

v
Generates verbose output on stderr.

m
Includes manifest information from specified pre-existing manifest file. Example use:
jar cmf myManifestFile myJarFile *.class
You can add special-purpose name-value attribute headers to the manifest file that aren't contained in the default manifest. Examples of such headers would be those for vendor information, version information, and package sealing. See the JAR Files trail in the Java Tutorial for examples of using the m option.

0
Store only, without using ZIP compression.

M
Do not create a manifest file for the entries.

If any of "files" is a directory, then that directory is processed recursively.

EXAMPLES

To add all the files in a particular directory to an archive:

C:/WWWROOT/JAVA> ls
12/09/96  12:20a        <DIR>          .    
12/09/96  12:17a        <DIR>          ..  
12/09/96  12:18a                 1,010 0.au
12/09/96  12:18a                   946 1.au
12/09/96  12:18a                 1,039 2.au
12/09/96  12:18a                   993 3.au
12/09/96  12:18a                 1,006 4.au
12/09/96  12:18a                 1,016 5.au
12/09/96  12:18a                 1,048 6.au
12/09/96  12:18a                   980 7.au
12/09/96  12:18a                 1,064 8.au
12/09/96  12:18a                   989 9.au  
12/09/96  12:19a                48,072 spacemusic.au
12/09/96  12:19a                   527 at_work.gif
12/09/96  12:19a                12,818 monkey.jpg
12/09/96  12:19a                16,242 Animator.class
12/09/96  12:20a                 3,368 Wave.class
              17 File(s)         91,118 bytes
                            414,983,168 bytes free

C:/WWWROOT/JAVA> jar cvf bundle.jar *
adding: 0.au
adding: 1.au
adding: 2.au
adding: 3.au
adding: 4.au
adding: 5.au
adding: 6.au
adding: 7.au
adding: 8.au
adding: 9.au
adding: Animator.class
adding: Wave.class
adding: at_work.gif
adding: monkey.jpg
adding: spacemusic.au
C:/WWWROOT/JAVA>
If already have subdirectories for images, audio files and classes in my html directory, I might jar up each directory into a single jar file:
C:/WWWROOT/JAVA> DIR
12/09/96  12:11a        <DIR>          .
12/09/96  12:17a        <DIR>          ..
12/03/96  06:54p        <DIR>          audio
12/06/96  02:02p        <DIR>          images
12/09/96  12:10a        <DIR>          classes
               6 File(s)        207,360 bytes
                            414,983,168 bytes free

C:/WWWROOT/JAVA> jar cvf bundle.jar audio classes images
adding: audio/1.au
adding: audio/2.au
adding: audio/3.au
adding: audio/spacemusic.au
adding: classes/Animator.class
adding: classes/Wave.class
adding: images/monkey.jpg
adding: images/at_work.gif
C:/WWWROOT/JAVA/Animator> dir
12/09/96  12:11a        <DIR>          .
12/09/96  12:17a        <DIR>          ..
12/09/96  12:11a               207,360 bundle.tar
12/03/96  06:54p        <DIR>          audio
12/06/96  02:02p        <DIR>          images
12/09/96  12:10a        <DIR>          classes
               6 File(s)        207,360 bytes
                            414,983,168 bytes free

C:/WWWROOT/JAVA/Animator> 
I can then see the entry names in the jarfile using the jar tool and the "t" option:
C:/WWWROOT/JAVA/Animator> jar tf bundle.jar
META-INF/MANIFEST.MF
audio/1.au
audio/2.au
audio/3.au
audio/spacemusic.au
classes/Animator.class
classes/Wave.class
images/monkey.jpg
images/at_work.gif
C:/WWWROOT/JAVA/Animator> 
Enumerating verbosely (with the "v" option) will tell me more information about the files in the archive, such as their size and last modified date:
C:/WWWROOT/JAVA/Animator> jar tvf bundle.jar
   145 Thu Aug 01 22:27:00 PDT 1996 META-INF/MANIFEST.MF
   946 Thu Aug 01 22:24:22 PDT 1996 audio/1.au
  1039 Thu Aug 01 22:24:22 PDT 1996 audio/2.au
   993 Thu Aug 01 22:24:22 PDT 1996 audio/3.au
 48072 Thu Aug 01 22:24:23 PDT 1996 audio/spacemusic.au
 16711 Thu Aug 01 22:25:50 PDT 1996 classes/Animator.class
  3368 Thu Aug 01 22:26:02 PDT 1996 classes/Wave.class
 12809 Thu Aug 01 22:24:48 PDT 1996 images/monkey.jpg
   527 Thu Aug 01 22:25:20 PDT 1996 images/at_work.gif
C:/WWWROOT/JAVA/Animator>
Java Archive Downloads - Java SE 6 JDK6 Java Archive Downloads - Java SE 6 立即下载

相关推荐

单相PWM整流器搭建训练——(一)拓扑原理介绍

单相整流器是一种将交流电转换为直流电的设备,主要由变压器、整流元件和滤波电路组成。变压器将输入的交流电压转换为适合整流的较低电压,整流元件(如二极管)利用其单向导电性将交流电转换为脉动直流电,最后滤波电路去除脉动直流电中的纹波,输出较为平滑的直流电,从而实现交流到直流的转换,广泛应用于各类电源设备中。

DikouNass的博客 1590

jar-The Java Archive Tool (转)

jar-The Java Archive Tool (转)[@more@]jar-The Java Archive Tool Combines multiple files into a single JAR archive ...

csd3176的博客 232

Foxglove Studio实战:5步搞定自动驾驶数据可视化(附避坑指南)

本文详细介绍了如何使用Foxglove Studio高效搭建自动驾驶数据可视化工作流。通过五个核心步骤:环境准备、数据导入、面板搭建、交互分析与自动化集成,帮助开发者快速掌握这一专为机器人系统设计的开源平台。文章重点解析了其与ROS/ROS 2、MCAP等数据源的无缝对接,以及3D点云、多传感器融合、团队标注等核心功能,并附有实用的性能优化与避坑指南,旨在提升算法调试与团队协作效率。

d3e4f的博客 339

【软件工具】Java语言编译成JAR(Java Archive)文件工具、工作原理简介

这是一个基本的例子,实际项目中可能需要包括多个类文件和资源。在更复杂的情况下,可以使用构建工具(如Maven或Gradle)来自动化编译和打包过程。这些工具提供了更高级的功能,如依赖管理和自动化构建流程。Maven是一个强大的构建工具,广泛用于Java项目的构建管理。它简化了构建过程,同时提供了项目管理和依赖管理的功能。,Maven就可以处理大部分的构建任务,使开发过程更加高效和可靠。Maven的强大功能在于它的自动化和标准化。假设我们有一个简单的Java项目,包含一个主类。工具的工作原理和一个使用例子。

weixin_46453070的博客 2238

七步设计高频变压器

七步设计高频变压器

m0_71394959的博客 5406

Aveva Marine C# 二次开发入门001

1# 引用 C:\AVEVA\Marine\OH12.1.SP4\Aveva.ApplicationFramework.dll C:\AVEVA\Marine\OH12.1.SP4\Aveva.ApplicationFramework.Presentation.dll 2# 引用命名空间, using Aveva.ApplicationFramework.Presentation;usi...

weixin_30245867的博客 1913

Java 常用工具类(30) : File工具类

import com.github.junrar.Archive; import com.github.junrar.rarfile.FileHeader; import org.apache.commons.compress.archivers.ArchiveException; import org.apache.commons.compress.archivers.ArchiveInpu...

Lxinccode的博客 1417

海康线扫相机平场矫正实战:从原理到精准成像

本文深入解析了海康线扫相机平场矫正的原理与实战操作。通过拆解暗场与明场矫正的物理意义,揭示了其消除系统噪声、补偿像素响应不均的核心机制。文章详细指导了在海康相机上进行平场矫正的标准化流程、关键参数设置(如行高、灰度值控制)及常见误区,并提供了针对高行频匹配、环境稳定性维护等进阶调优技巧与问题排查指南,旨在帮助用户实现从原理理解到精准成像的跨越。

tomato的博客 796

【Java之JAR包解析】(一)如果你也跟我一样搞懂了rt.jar,那真的泰裤辣! · 上篇~

JAR (Java ARchive) 是一种 Java 打包文件格式,它可以将一组 Java 类文件、相关资源和元数据打包到一个单独的文件中。JAR 文件通常用于分发 Java 应用程序或库,并且可以在不同平台上运行。 JAR 包是一种方便的方式来组织和管理 Java 代码和依赖项,并且可以轻松地与其他开发人员共享和部署代码。JAR 包还支持数字签名和版本控制,以确保代码的完整性和安全性。 进入Java的安装路径下的 jre\lib 目录,就可以看到 JRE环境所依赖的一些JAR包:rt.jar包...

Technology changes the world of life 1万+

红米K70至尊版修复“nv损坏”主板电阻图示 mtk芯片工程固件刷写与步骤说明

💝💝💝红米K70至尊版 机型代码:rothko,搭载天玑9300+旗舰芯片.后置5000万像素索尼IMX906高动态OIS主摄,800万像素超广角镜头,200万像素微距镜头,前置2000万像素摄像头,也适用于以下型号的小米机型:2407FPN8EG,2407FPN8ER,XIG06,A402XM,2407FRK8EC。 💝💝💝通过博文了解 1💝💝💝-----此机型工程固件的资源刷写注意事项 2💝💝💝-----此机型刷写工程固件预览界面 3💝💝💝------红米K

小马哥的专栏 1462

KylinOS 离线安装 MinIO【图文步骤】

在国产操作系统 KylinOS 中安装 MinIO,详细步骤...

甘蓝的专栏 1538

转载 Jar(Java Archive)Java 文件归档

JAR(Java ARchive,Java 归档)是一种与平台无关的文件格式,可将多个文件合成一个文件。用户可将多个 Java applet 及其所需组件(.class 文件、图像和声音)绑定到 JAR 文件中,而后作为单个的简单 HTTP(Hypertext Tranfer Protocal,超文本传输协议)事务下载到浏览器中,从而大大提高下载速度。JAR 格式也支持压缩,从而减小了文件的大小,进一步缩短下载时间。另外,applet 编写者也可在 JAR 文件中用数字签名的方式签写各项以确认其来源。它用

Myblog 573

RT-DETR改进策略【损失函数篇】| 通过辅助边界框计算IoU提升检测效果(Inner_GIoU、Inner_DIoU、Inner_CIoU、Inner_EIoU、Inner_SIoU)

为了弥补现有 IoU 损失在不同检测任务中泛化性弱和收敛速度慢的问题,·Inner-IoU·通过引入比例因子 “ratio” 来控制辅助边界框的尺度大小,利用不同尺度的辅助边界框来计算损失,从而加速边界框回归过程。

Limiiiing的博客 1966

Java存档工具(JAR)示例

这是项目结构。 /workspace/test/classes/com/mkyong/awt/AwtExample.class /workspace/test/classes/com/mkyong/awt/AwtExample2.class /workspace/test/classes/com/mkyong/awt/AwtExample3.class /workspace/test/cla...

一名可爱的技术搬运工 460

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

Java tutorial学习笔记——JAR文件

概述 通常情况下,jar文件中包含有class文件、程序关联的资源文件。 安全,开发者可以对jar文件进行数字签名,识别签名的用户获得安全权限。 压缩 包扩展,添加功能给java核心平台。 包密封,将一个package下的所有class文件打包进同一个jar文件下。     使用JAR文件 JAR文件使用ZIP文件格式打包 JDK已经提供了Java Archive Tool,用...

小黑王HK 350

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Java JDK 常用工具命令 javac、jar、java、javaw,替换 .jar 包 class 文件,脚本启停 spring boot Jar 包服务

目录 javac.exe 编译 jar.exe 打包 java.exe 执行 javaw.exe 命令 javac.exe 编译 1、编写的 Java 源文件执行之前都需要使用 javac.exe 命令进行编译,即 *.java 编译成 *.class。 2、javac.exe 在 %JAVA_HOME%/bin 目录下,配置好环境变量后,命令行中可以直接运行。命令行中输入 java...

蚩尤后裔-汪茂雄 4960

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

Eclipse下启动tomcat报错:/bin/tool.jar which is referenced by the classpath, does not exist.

1.错误: 在Eclipse下启动tomcat的时候,报错为:Eclipse下启动tomcat报错:The archive: D:/Program Files/Java/jdk1.7.0_10/lib/tools.jar which is referenced by the classpath, doesnot exist. 2.原因: 这是因为我中途移动

zhouzhiwengang的专栏 6534

jar 工具

为了用 JAR 文件执行基本的任务,要使用作为 Java Development Kit 的一部分提供的 Java Archive Tool ( jar工具 )。用 jar命令调用 jar工具。表 1 显示了一些常见的应用: 表 1. 常见的 jar工具用法 功能 命令 用一个单独的文件创建一个 JAR 文件 jar cf jar-file input-file... ...

悠悠我心 152

Eclipse下启动tomcat报错:/bin/bootstrap.jar which is referenced by the classpath, does not exist.

在Eclipse下启动tomcat的时候,报错为:Eclipse下启动tomcat报错:The archive: C:/Program Files(x86)/Java/jdk1.7.0_10/lib/tools.jar which is referenced by the classpath, doesnot exist.解决办法:1.双击servers选项下的tomcat,打开如下界面:然后点击...

wolovedaima123的博客 2095

Eclipse下启动tomcat报错:The archive: C:/Program Files(x86)/Java/jdk1.7.0_10/lib/tools.jar which is refere

1.错误: 在Eclipse下启动tomcat的时候,报错为:Eclipse下启动tomcat报错:The archive: C:/Program Files(x86)/Java/jdk1.7.0_10/lib/tools.jar which is referenced by the classpath, doesnot exist. 2.原因: 这是因为我中途移动过

水土不服的博客 8386

The archive: F:/soft/java/jdk-8u31-windows-x64/lib/tools.jar which is referenced by the classpath,

解决: The archive: F:/soft/java/jdk-8u31-windows-x64/lib/tools.jar which is referenced by the classpath, 参考链接 http://blog.youkuaiyun.com/jimoshuicao/article/details/52664067?locationNum=4&fps=1地址

shursulei的博客 1541

eclipse启动tomcat jar不存在

1.错误: 在Eclipse下启动tomcat的时候,报错为:Eclipse下启动tomcat报错:The archive: C:/Program Files(x86)/Java/jdk1.7.0_10/lib/tools.jar which is referenced by the classpath, doesnot exist. 2.原因: 这是因为我中途移动过

Richard_Stevin的博客 920

Eclipse下启动tomcat报错:/bin/bootstrap.jar which is referenced by the classpath, does not exist....

1.错误: 在Eclipse下启动tomcat的时候,报错为:Eclipse下启动tomcat报错:The archive: C:/Program Files(x86)/Java/jdk1.7.0_10/lib/tools.jar which is referenced by the classpath, doesnot exist. 2.原因: 这是因为我中途移动过tomcat的位置的...

weixin_30385925的博客 440

The archive: D:/Program Files (x86)/apache-tomcat-6.0.39/bin/bootstrap.jar w

1.错误: 在Eclipse下启动tomcat的时候,报错为:Eclipse下启动tomcat报错:The archive: C:/Program Files(x86)/Java/jdk1.7.0_10/lib/tools.jar which is referenced by the classpath, doesnot exist. 2.原因: 这是因为我中途移动过tomcat的位置的...

weixin_33778778的博客 109

【转】Eclipse下启动tomcat报错:/bin/bootstrap.jar which is referenced by the classpath, does not exist....

转载地址:http://blog.youkuaiyun.com/jnqqls/article/details/8946964 1.错误: 在Eclipse下启动tomcat的时候,报错为:Eclipse下启动tomcat报错:The archive: C:/Program Files(x86)/Java/jdk1.7.0_10/lib/tools.jar which is referenced by th...

weixin_30906671的博客 176
上一篇: Drag and Drop: New Data Transfer Capabilities in the JavaTM 2 Platform, Standard Edition (J2SETM), version 1.4
下一篇: Getting Listeners from JavaBeansTM
CanFly
博客等级 码龄25年 0粉丝 18原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值