본문 바로가기
Spring

[Spring; 스프링] JAR , WAR, EAR 차이점 및 특징

by daddydontsleep 2024. 2. 1.
728x90
728x90

사진: Unsplash 의 Annie Spratt

개요

JAR (Java ARchive, 자바 아카이브)는 여러 개의 자바 클래스 파일과, 클래스들이 이용하는 관련 리소스(텍스트, 그림 등) 및 메타데이터를 하나의 파일로 모아서 자바 플랫폼에 응용 소프트웨어나 라이브러리를 배포하기 위한 소프트웨어 패키지 파일 포맷이다.

WAR (Web application ARchive, 웹 애플리케이션 아카이브) 파일은 소프트웨어 공학에서 자바서버 페이지, 자바 서블릿, 자바 클래스, XML, 파일, 태그 라이브러리, 정적 웹 페이지 (HTML 관련 파일) 및 웹 애플리케이션을 함께 이루는 기타 자원을 한데 모아 배포하는 데 사용되는 JAR 파일이다.

JAR, WAR 모두 JAVA의 jar 툴을 이용하여 생성된 압축(아카이브) 파일이며 애플리케이션을 쉽게 배포하고 동작시킬 수 있도록 관련 파일(리소스, 속성파일 등)을 패키징 해주는 것이 주 역할이다.

개발을 하다보면 WAR와 JAR를 모두 봤을 것이다.(안 봤음 말고...) 

오늘은 간단하게 특징과 차이점에 대해 알아보겠다.

JAR ( Java ARchive )

.jar 확장자 파일에는 Class와 같은 Java 리소스, 속성 파일, 라이브러리 등 파일이 포함되어 있다.

쉽게 말하면 Java 애플리케이션이 동작할 수 있도록 자바 프로젝트를 압축한 파일로 생각하면 된다.

실제로 jar 파일은 플랫폼에 귀속되는 것만 빼면 zip파일과 동일한 구조이다.

jar 파일은 원하는 구조로 구성이 가능하며 JDK ( Java Development Kit )에 포함하고 있는 JRE ( Java Runtime Environment )만 가지고도 실행이 가능하다.

WAR ( Web application ARchive )

.war 확장자 파일은 servlet, jsp container에 배치할 수 있는 웹 애플리케이션(Web Application) 압축 파일 포맷이다.

JSP, Servlet, jar, class, xml, html, javascript 등 Servlet Context 관련 파일들로 패키징 되어있다.

WAR는 웹 응용 프로그램을 위한 포맷이기 때문에 웹 관련 자원만 포함하고 있고 이를 사용하면 웹 애플리케이션을 쉽게 배포하고 테스트할 수 있다.

원하는 구성을 할 수 있는 JAR 포맷과 달리 WAR는 WEB-INF 및 META-INF 디렉터리로 사전 정의 된 구조를 사용하며 WAR파일을 실행하려면 Tomcat, Weblogic, JEUS 등의 웹 서버 또는 웹 컨테이너(WAS)가 필요하다.

WAR 파일도 JAVA의 JAR 옵션 (java -jar) 을 이용해 생성하는 JAR 파일의 일종으로 웹 애플리케이션 전체를 패키징 하기 위한 JAR 파일로 생각하면 된다.

EAR ( Enterprise ARchive )

번외로 EAR 파일은 JAVA EE (Enterprise Edition)에서 쓰는 파일 포맷으로 한 개 이상의 모듈을 단일 아카이브로 패키징 해서 애플리케이션 서버에 동시에 일관되게 올리기 위해 사용되는 포맷이다.

끝.

 

 

[reference]

JAR (file format) - Wikipedia

 

JAR (file format) - Wikipedia

From Wikipedia, the free encyclopedia Java archive file format A JAR ("Java archive") file is a package file format typically used to aggregate many Java class files and associated metadata and resources (text, images, etc.) into one file for distribution.

en.wikipedia.org

Difference between jar and war in Java - Stack Overflow

 

Difference between jar and war in Java

What is the difference between a .jar and a .war file? Is it only the file extension or is there something more?

stackoverflow.com

War (disambiguation) - Wikipedia

 

War (disambiguation) - Wikipedia

From Wikipedia, the free encyclopedia Look up war or war- in Wiktionary, the free dictionary. War is a large-scale armed conflict and the term is used as a metaphor for non-military conflicts. War or WAR may also refer to: Performers[edit] "War" (Bob Marl

en.wikipedia.org

[Java] JAR WAR 차이점 및 특징 ( + EAR ) :: IfUwanna IT (tistory.com)

 

[Java] JAR WAR 차이점 및 특징 ( + EAR )

JAR (Java Archive) WAR (Web Application Archive) 모두 JAVA의 jar 툴을 이용하여 생성된 압축(아카이브) 파일이며 어플리케이션을 쉽게 배포하고 동작시킬 수 있도록 있도록 관련 파일(리소스, 속성파일 등)들

ifuwanna.tistory.com

web.archive.org/web/20120626012843/http://java.sun.com/developer/Books/javaprogramming/JAR/basics

 

Oracle Java Technologies | Oracle

Java Is the Language of Possibilities Java is powering the innovation behind our digital world. Harness this potential with Java resources for student coders, hobbyists, developers, and IT leaders.

www.oracle.com

Web Application Archives

 

Web Application Archives

Web Application Archives Web clients are packaged in Web application archives. In addition to Web components, a Web application archive usually contains other files, including the following: Server-side utility classes (database beans, shopping carts, and

web.archive.org

 

728x90
300x250