0

Why do we need WAR? if we can create JAR and deploy it on servlet container.

1 Answers1

4

They are all compressed files, if thats what you mean. But they are not all jars. The internal file layout are different between jar and war.

WAR (Web Archive) contains deployment descriptor (web.xml) plus jar dependencies plus your classes and other resources. A typical web container unpacks the deployed WAR file into the the webapp's directory before running the webapp.

So put it very simple: - war may contain jar, etc. - jar may contain classes, etc.

Abdelhak
  • 8,299
  • 4
  • 22
  • 36