经常在我们Java Web项目中看到jar/war/ear这几种文件类型,它们之间有何不同之处呢?我查了一些资料归纳整理如下:
jar/war /ear三种文件,在文件结构上,三者并没有什么不同,它们都采用zip或jar档案文件压缩格式。但是它们的使用目的有所区别:
Jar文件(扩展名为. Jar)包含Java类的普通库、资源(resources)、辅助文件 (auxiliary files)等
War文件(扩展名为.War)包含全部Web应用程序。在这种情形下,一个Web应用程序被定义为单独的 一组文件、类和资源,用户可以对jar文件进行封装,并把它作为小型服务程序(servlet)来访问。
Ear文件(扩展名为.Ear)包含全部企业应用程序。在这种情形下,一个企业应用程序被定义为多个jar 文件、资源、类和Web应用程序的集合。
每一种文件(.jar, .war, .ear)只能分别由应用服务器(application servers)、小型服务程序容器(servlet containers)、EJB容器(EJB containers)等进行处理。
JAR WAR EAR
英文 Java Archive file ; Web Archive file Enterprise Archive file
jar:包含内容 class、properties文件,是文件封装的最小单元; war:Servlet、JSP页面、JSP标记库、JAR库文件、HTML/XML文档和其他公用资源文件,如图片、音频文件等;ear:除了包含 JAR、WAR以外,还包括EJB组件
部署文件 application-client.xml web.xml application.xml
级别 小 中 大
jar:封装类 war:封装web站点 ear:可以封装ejb
JAR: Software developers generally use .jar files to distribute Java applications or libraries, in the form. of classes and associated metadata and resources (text, images, etc.) JAR files build on the ZIP file format.
WAR: In computing, a WAR file (which stands for "web application archive" ) is a JAR file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages (HTML and related files) that together constitute a Web application.
EAR: An Enterprise ARchive, or EAR, is a file format used by Java EE for packaging one or more modules into a single archive so that the deployment of the various modules onto an application server happens simultaneously and coherently. It also contains XML files called deployment descriptors which describe how to deploy the modules. Maven or Ant can be used to build EAR files.
RAR: A Resource Adapter is an archive file format defined in the J2EE Connector Architecture (JCA) specification. A Resource Adapter aRchive (RAR) file is the valid format for deployment of resource adapters on application servers. J2EE RAR files may also be called connectors.
其他概念:
EJB: Enterprise JavaBeans (EJB) is a managed, server-side component architecture for modular construction of enterprise applications. The EJB specification is one of several Java APIs in the Java EE. EJB is a server-side model that encapsulates the business logic of an application.
JavaBean: JavaBeans are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects. A JavaBean is a Java Object that is serializable, has a nullary constructor, and allows access to properties using getter and setter methods.
Metadata: Metadata is a means to describe the data files.It provides information about a certain item's content, such as: means of creation, purpose of the data, time and date of creation, creator or author of data, placement on a network (electronic form) where the data was created, what standards used (ISO9000), etc.
分享到:
相关推荐
war包_jar包_ear包_及打包方法
关于war包_jar包_ear包_及打包方法
jar_war_ear文件.doc
Java中Ear、Jar、War文件之间有何不同
本篇文章,小编为大家介绍,基于Java的打包jar、war、ear包的作用与区别详解。需要的朋友参考下
专门搜索jar,zip,war,ear压缩包里包含的文件
怎样制作ear,war文件?提供两种方法
对于Java开发人员来说,这是一个非常有用的实用程序。 有时您的项目可能依赖于各种库。 但是,提供具有依赖项的桌面应用程序不是一个好主意。 该实用程序有助于将所有... 该实用程序可用于合并JAR,WAR,EAR和ZIP文件。
WildFly可启动JAR包含服务器和打包的应用程序(JAR,EAR或WAR)。 构建应用程序并将其打包为可启动JAR之后,您可以使用以下命令启动该应用程序: java -jar target/myapp-bootable.jar要获取启动参数列表: java -...
<ear destfile="${dist}/ant_ear.ear" basedir="${compile}" /> </target> <!--打包成.war夹包--> <target name="warFile" depends="compile"> <war destfile="${dist}/ant_war.war" basedir="${compile}"/>...
java ...jar/war/ear.. 等 diff 包。 在我们的示例中,我们正在制作 war 文件,我们将部署 进入tomcat webapps目录,本地就可以访问了, 前任: 以上上下文根: /bookstore ,相同的名称必须与 webapps
递归搜索给定 java 类的 zip/jar/ear/war 文件和目录列表
org.apache.tools.ant.taskdefs.Ear org.apache.tools.ant.taskdefs.Get org.apache.tools.ant.taskdefs.Jar org.apache.tools.ant.taskdefs.Tar org.apache.tools.ant.taskdefs.War org.apache.tools.ant....
支持来自各种生态系统的包和库(APK、DEB、RPM、Ruby Bundles、Python Wheel/Egg/requirements.txt、JavaScript NPM/Yarn、Java JAR/EAR/WAR、Jenkins 插件 JPI/HPI、Go 模块) Linux 发行版识别(支持 Alpine、...
- 可以解压、压缩、替换jar/zip/apk/ear/war文件中的单个文件以及整个目录(长按文件或目录)。 - 资源分支选择功能,可方便修改不同分辨率、不同语言、横竖屏等差异化资源; (这里重点说下语言选择功能。现在的...
解决myeclipse10.6不能正常导出ear或war包问题,导出时出现security alert:integrity check error 内附解决方法和jar包com.genuitec.eclipse.export.wizard_9.0.0.me201203160414.jar 关掉myeclipse10.6,替换文件,...
maven工程备份,基于maven archetype,打完jar包打war包再打ear包
这是一个Python cli命令行实用程序,使您可以在系统的jar / ear / war的特定目录/路径下的Java类/文件和程序包中搜索所有文档。所有文档都在Wiki上:http:// javaclassfind。 wiki.sourceforge.net/
maven 用法 指南 java 基础 配置 安装 入门 eclipse jar ear war 打包 rad
在像我们这样的标准 Maven 多模块项目(EAR / EJB / WAR / JAR)中,您需要按如下方式设置依赖项。 首先要做的是在<artifactIdPrefix>/pom.xml的dependencyManagement部分中添加依赖<artifactIdPrefix>/pom.xml 。 ...