.jar文件和.war文件有什么区别? 仅仅是文件扩展名还是还有其他的东西?
当前回答
You add web components to a J2EE application in a package called a web application archive (WAR), which is a JAR similar to the package used for Java class libraries. A WAR usually contains other resources besides web components, including: Server-side utility classes (database beans, shopping carts, and so on). Static web resources (HTML, image, and sound files, and so on) Client-side classes (applets and utility classes) A WAR has a specific hierarchical directory structure. The top-level directory of a WAR is the document root of the application. The document root is where JSP pages, client-side classes and archives, and static web resources are stored.
(源)
所以。war是一个。jar,但它包含web应用程序组件,并根据特定的结构进行布局。.war被设计为部署到web应用服务器(如Tomcat或Jetty)或Java EE服务器(如JBoss或Glassfish)。
其他回答
此外,使用嵌入式容器,你可以直接运行一个JAR文件,就像用spring boot运行你的java应用程序一样,设置一个web服务器。但是,对于WAR文件,您需要首先设置一个web服务器,例如Tomcat。
ear jar和war文件的区别:
这些文件只是压缩文件 使用Java jar工具。这些文件是 为了不同的目的而创造。在这里 是这些文件的描述: .jar文件:.jar文件包含 图书馆、资源和 附件文件,如属性文件。 .war文件:war文件包含 可以是web应用程序 部署在任何servlet/jsp上 容器。.war文件包含jsp, Html, javascript等文件 这是网络发展所必需的 应用程序。
Sun/Oracle官方描述:
J2EETM教程:Web应用程序档案 Java归档(JAR)文件格式:基础
维基百科:
WAR文件格式(Sun) JAR文件
.war文件具有特定的文件位置结构。除此之外,是的,它只是一个。jar。
WAR代表Web应用程序存档
JAR代表Java存档
You add web components to a J2EE application in a package called a web application archive (WAR), which is a JAR similar to the package used for Java class libraries. A WAR usually contains other resources besides web components, including: Server-side utility classes (database beans, shopping carts, and so on). Static web resources (HTML, image, and sound files, and so on) Client-side classes (applets and utility classes) A WAR has a specific hierarchical directory structure. The top-level directory of a WAR is the document root of the application. The document root is where JSP pages, client-side classes and archives, and static web resources are stored.
(源)
所以。war是一个。jar,但它包含web应用程序组件,并根据特定的结构进行布局。.war被设计为部署到web应用服务器(如Tomcat或Jetty)或Java EE服务器(如JBoss或Glassfish)。
推荐文章
- Java构造函数继承
- 如何在Java中将int[]转换为Integer[] ?
- 你能解释一下流的概念吗?
- 导致java.lang.VerifyError错误的原因
- 如何在Java中监控计算机的CPU、内存和磁盘使用情况?
- 如何设置超时在改造库?
- java lambda可以有一个以上的参数吗?
- HashMap -获取第一个键值
- 使用Jackson将JSON字符串转换为漂亮的打印JSON输出
- Android - SPAN_EXCLUSIVE_EXCLUSIVE跨度不能为零长度
- Javadoc @see或{@link}?
- 在准备语句中使用“like”通配符
- Android Eclipse -无法找到*.apk
- javac和Eclipse编译器之间的区别是什么?
- 工厂模式和策略模式之间的区别是什么?