** Reprinted from http://apps.hi.baidu.com/share/detail/30355098
What's the difference between Ear, Jar, War files? In which environment are they used?
In terms of file structure, the three are not different, they all use the zip or jar archive file compression format. But they are used for different purposes:
Jar files (extension .jar) contain common libraries, resources, auxiliary files, etc. of Java classes
A War file (with the extension .War) contains the entire web application. In this case, a Web application is defined as a single set of files, classes, and resources, and the user can encapsulate the jar file and access it as a small service program (servlet).
Ear files (with the extension .Ear) contain all enterprise applications. In this case, an enterprise application is defined as a collection of jar files, resources, classes, and web applications.
Each type of file (.jar, .war, .ear) can only be processed by application servers, servlet containers, EJB containers, etc. ]
================================================================
From the end customer's point of view, a .jar file is a kind of encapsulation, they don't need to know how many .class files are in the .jar file, and the functions and functions in each file can also get the results they want. In addition to jar, there are war and ear for J2EE. The difference is shown in the table below:
JAR |
WAR |
EAR |
|
English | Java Archive file | Web Archive file | Enterprise Archive file |
Included | class and properties files are the smallest unit of file encapsulation; | Servlet, JSP page, JSP tag library, JAR library file, HTML/XML document and other public resource files, such as pictures, audio files, etc.; | In addition to containing JAR, WAR, also includes EJB components |
deployment file | application-client.xml | web.xml | application.xml |
level | little | middle |
=================================================================
These three files can be regarded as java compression formats, and their essence is to achieve different encapsulation:
jar表示java的标准档案文件,有一个有趣的双关语:a jar of beans(一罐豆子)。
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)等进行处理。]
ear包:企业级应用,通常是EJB打成ear包。 ear是J2ee的应用文件的扩展名
是打包了的企业应用程序,里面可包含war(web Application archiever),ejb等
war包:是做好一个web应用后,通常是网站,打成包部署到容器中。
jar包:通常是开发时要引用通用类,打成包便于存放管理。
=============================================================
在快速启动栏中的“显示桌面”图标,有时会不小心误操作而弄丢失了,如果我们知道了“显示桌面”的图标文件是如何产生的,我们就可以非常轻松的找回来了。 还有一个更简单的方法是:在“运行”对话框中输入“REGSVR32 /n /i:u shell32”(不含双引号),然后回车,片刻后会弹出“shell32中的DllInstall成功”对话框,“显示桌面”按钮就出现了。 |