Difference Between Similar Terms and Objects

Difference Between JAR and WAR


The first thing a non-technical person needs to understand is that JAR and WAR are types of files. They are used to package different modules and have different functions. People who already know about these files are sometimes confused as to their different functionalities. They are archived files and are commonly used and created for web applications and holding many files together.

JAR files are an acronym for “Java Archive” files; WAR files are an acronym for “Web Application Archive” files. The functionality of these files are different, and in application of J2EE, the packaging of modules is either as WAR or JAR based on their functionality.

JAR files allow the aggregation of multiple files into a single file. They are commonly used in a library to hold the Java classes or utility along with some files which are static like videos and images. It is usually for easier accessibility. Whereas WAR files may store Java classes, XML, and Java Server pages for different applications of the web.
The EJB module is packaged as JAR files. This module contains EJB descriptor and Java beans class files. These are packaged with a .jar extension; whereas the web module is packaged as WAR files. This module contains JSP files, Servlet class files, Supporting files, HTML, and GIF. They are packaged as a .war extension.
WAR files are used for web applications. They are deployed to a JSP engine or to a servlet. The WAR file also has a WEB–INF directory, the WEB.xml which is the deployment descriptor sits at the directory; whereas the JAR files are underneath the WEB-INF/classes directories and WEB-INF /lib.


1.The main difference between JAR files and WAR files is that one can package many different things in JAR files. It is most commonly used to package Java classes, but a lot of other things can be packaged as well. However, WAR files are specifically for web applications.
2.JAR files can be created with any format and directory of your choice; whereas WAR files are created from Servlets. 3.They have a specific format; they have specific directories and files. The WAR files have a WEB-INF directory, WEB-INF/lib directory, WEB-INF/web.xml, and WEB-INF/classes directory.
4.The acronym of “JAR” files is “Java Archive” files; whereas the acronym of “WAR” files is “Web Application Archive” files.
5.The JAR files are packaged with a .jar extension; whereas WAR files are packaged with a .war extension.
6.EJB modules are packaged as JAR files. This module contains an EJB descriptor and Java beans class files; whereas web modules are packaged as WAR files which contain JSP files, Servlet class files, supporting files, GIF, and HTML.

Sharing is caring!

Search DifferenceBetween.net :

Email This Post Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.

1 Comment

  1. Excellent explanation.

Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Articles on DifferenceBetween.net are general information, and are not intended to substitute for professional advice. The information is "AS IS", "WITH ALL FAULTS". User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.

Protected by Copyscape Plagiarism Finder