Jar
โข
ํจํค์ง ํ์ผ ํฌ๋งท์ด๋ค.
โข
jar ํ์ฅ์๋ฅผ ๊ฐ์ง๋ค.
โข
library, resource, metadata file ๋ค์ ๊ฐ์ง๋ค.
โข
์์ถ๋ class ํ์ผ๊ณผ ์ปดํ์ผ๋ java library ์ application ์์๋ค์ ํฌํจํ๋ค.
META-INF/
MANIFEST.MF
com/
eden/
MyApplication.class
Shell
๋ณต์ฌ
โข
MANIFEST.MF
โฆ
์์นด์ด๋ธ์ ์ ์ฅ๋ ํ์ผ๋ค์ ๋ํ ๋ฉํ๋ฐ์ดํฐ๋ฅผ ํฌํจํ๋ค.
โข
jar ๋ ๋น๋ ํด(Maven, Gradle) ๋ก Jar ํ์ผ ์์ฑ ๊ฐ๋ฅ
War
โข
Web Application Archive
โข
Servlet, JSP ์ปจํ
์ด๋๊ฐ ์๋ ์น ์ดํ๋ฆฌ์ผ์ด์
์ ํจํค์งํ ๋ ์ฌ์ฉ๋๋ค.
META-INF/
MANIFEST.MF
WEB-INF/
web.xml
jsp/
helloWorld.jsp
classes/
static/
templates/
application.properties
lib/
// *.jar files as libs
Shell
๋ณต์ฌ
โข
WEB-INF ์๋ html, js ๋ฑ๊ณผ ๊ฐ์ ์ ์ ํ์ผ๊ณผ servlet class, web.xml ๋ฑ๊ณผ ๊ฐ์ ํ์ผ๋ ์๋ค.
์ฐจ์ด
JAR files allow us to package multiple files in order to use it as a library, plugin, or any kind of application. On the other hand, WAR files are used only for web applications.
The structure of the archives is also different.ย We can create a JAR with any desired structure. In contrast, WAR has a predefined structure withย WEB-INFย andย META-INFย directories.
Finally, we canย run a JAR from the command lineย if we build it as anย executable JARย without using additional software. Or, we can use it as a library. In contrast, weย need a server to execute a WAR.