Friday, October 22, 2010

What is JAR ,WAR and EAR . How to build them using ANT

HI,
In JEE, application modules are packaged as EAR, JAR and WAR based on their functionality.Each type of file (.jar, .war, .ear) is processed uniquely by application servers. I am just collecting the stuff for my reference.  :)

JAR:
       Jar file (file with a .jar extension) is the normal Java Application archive and intended to hold generic libraries of Java classes, resources, auxiliary files, etc.This can be added in classpath for compilation and to run java program. Generally in web applications we keep these files in lib directory of the application.
Ex: ojdbc14.jar – This contains all the classes to connect the oracle database
Servlet-api.jar – contains servlet related classes

Ant Task for JAR

 
for ant task details click here. 

WAR:
           Web modules which contains Servlet class files,JSP Files,supporting files, GIF and HTML files are packaged as JAR file with .war( web archive) extension. War files (files with a .war extension) are intended to contain complete Web applications. In this context, a Web application is defined as a single group of files, classes, resources, .jar files that can be packaged and accessed as one servlet context.

 Ant Task for WAR


   
  
  
  
  
  
 

for ant task details click here.


EAR:
        All above files(.jar and .war) are packaged as JAR file with .ear ( enterprise archive) extension and deployed into Application Server.  Ear files (files with a .ear extension) are intended to contain complete enterprise applications. In this context, an enterprise application is defined as a collection of .jar files, resources, classes, and multiple Web application.

Ant Task for EAR



      
    
 
for ant task details click here.

 Thanks.

No comments: