Definition--定义
A JAR(Java Archive) file is a file with Java classes, associated metadata, and resources such as text and images aggregated into one file.
A WAR(Web Application Resource or Web Application Archive) file is a file that is used to distribute a collection of JAR files, JSP, Servlet, XML files, static web pages like HTML and other resources that constitute a web application.
An EAR file is a standard JAR file that represents the modules of the application, and a metadata directory called META-INT which contains one or more deployment descriptors. Thus, this is the main difference between JAR WAR and EAR files.
File Extension-扩展名
A JAR file has the .jar file extension .
A WAR file has the .war file extension.
An EAR file has the .ear file extension.
Usage--用途
JAR file allows Java Runtime Environment (JRE) to deploy an entire application including the classes and related resources in a single request.
WAR file allows testing and deploying web applications easily
Conclusion--总结
The JAR file is a file that has Java class files, related metadata, and resource combined into a single file to execute a Java application.
The WAR file is a file that contains files such as a servlet, JSP, HTML, JavaScript, etc. that are necessary to develop web applications.
EAR is a Java EE file that packages one or more modules into a single archive to deploy them on to an application server.
【引文】https://pediaa.com/what-is-the-difference-between-jar-war-and-ear/