What is the difference between EAR, JAR and WAR file?

What is the difference between EAR, JAR and WAR file?

- .jar files :

- These files have .jar extension.

- A .jar file contains .class files, resources like .java and property files.

- The .jar file can be appended to environment variable CLASSPATH in order to any java application to access from remote package.

.war files :

- These files have the .war extension.

- The web application that is to be deployed on servlet or JSP container is too converted into .war file and can be deployed using Tomcat browser.

- The .war file can have .jsp, html, .js and any other files which would necessary for a web application.

.ear files :

- The enterprise applications that are to be deployed in EJB container are to be placed in an .ear file.

What is the difference between EAR, JAR and WAR file?

J2EE defines three types of archives :

1. Java Archives (JAR) :

- A JAR file encapsulates one or more Java classes, a manifest, and a descriptor.

- JAR files are the lowest level of archive.

- JAR files are used in J2EE for packaging EJBs and client-side Java Applications.

2. Web Archives (WAR) :

- WAR files are similar to JAR files, except that they are specifically for web applications made from Servlets, JSPs, and supporting classes.

3. Enterprise Archives (EAR) :

- An EAR file contains all of the components that make up a particular J2EE application.
What is EJB client JAR file?
What is EJB client JAR file? - EJB client JAR file: This file is used for client projects. This file includes the .class files of the client.....
What is Deployment descriptor?
What is Deployment descriptor? - A deployment descriptor is a configuration file for a web application or EJB application which is to be deployed to web or EJB container....
How EJB Invocation happens?
How EJB Invocation happens? - The following are the invocation steps for EJB: Step 1: Using JNDI, retrieve Home Object reference from Naming Service...
Post your comment