• Post Reply Bookmark Topic Watch Topic
  • New Topic

difference between .jar and .war files  RSS feed

 
srinivas rao
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know that jar file is a zipped file which contains .class files
and war file is a zipped fiel that contains class files of servlets it may also inclde html and jsp


but wht is the clear difference between war and jar file
and wht is command to make the jar and war file
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36441
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandiri,
Welcome to JavaRanch!

You got the difference between a JAR and a WAR. WARs are web applications containing HTML, JSPs, servlets and a deployment descriptor. All of these files must be arranged in a specified directory format.

This article from Sun provides more details on the directory structure. It also provides the syntax of the jar command for creating jars/wars. Note that it is the same command as the compression technique is the same. for both.
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you pretty much have it. Except most servlet engines like tomcat will recognize war files and unpack them.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the difference is exactly one letter...
And of course a war file is expected to have a certain directory layout which corresponds with the directory layout of a valid web application, but that's no different from a standard jar file being expected to have a directory layout corresponding to a package tree
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!