How to Make Jar, War and Ear Files in Easy Steps

In Software Development, programming is written in component level and components are integrated at final stage of development process. This Stage requires packaging for various components (files) into one package. I am going to discuss how to make these 3 packaging formats for Java programming language but before makes your hand dirty let me introduce all three formats:

Jar File-


 JAR (Java ARchive) is an archive file format typically used to aggregate many Java class files and associated metadata and resources (text, images and so on) into one file to distribute application software or libraries on the Java platform

War File:


A WAR file (or Web application ARchive) is a JAR file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, tag libraries, static Web pages (HTML and related files) and other resources that together constitute a Web application.

Ear File:


EAR (Enterprise ARchive) is a file format used by Java EE for packaging one or more modules into a single archive so that the deployment of the various modules onto an application server happens simultaneously and coherently. This file also contains XML files. These XML files called deployment descriptors which describe how to deploy the modules.

Process of making Jar, war and Ear file:


 Suppose you have a folder, its named as  “Ripe” in “F:” drive of your computer in which you have  source code(.java), generated code(.class) files and you want to make War/Jar/Ear of all data or selected file in that particular folder. Now you have to follow these steps:-

1-Open your computer command prompt (cmd) and type F: to change drive then give path inside your folder by type this cd Ripe and press Enter. This will set your cmd path to your folder in which you want to create your file. Look at the screen shot below:
cmd 1
2-Assume that your file name is “tech” which you are going to make. 
3- Now, For Jar file type jar cvf tech.jar *.* hit enter and you would find war file in your Ripe folder. Look at the screen shot below:
cmd2
4- For War File, Type- jar cvf tech.war *.* hit enter and done. See the screen shot below.
cmd3
5-For Ear File, Type- jar cvf tech.ear *.* hit enter. See the screen shot:
cmd4

You can choose particular file format from your folder by enter file format like *.java or *.class or *.txt instead of *.* in command prompt .*.* means all files inside the folder.
is a full time blogger who love to share new tips & tricks related with internet, social media, technology, Internet marketing, wordpress etc.