JAR - JAVA

JaeYeon Won·2024년 8월 26일

What is JAR?[1]

JAR stands for Java ARchive. It's a file format based on the popular ZIP file format and is used for aggregating many files into one. Although JAR can be used as a general archiving tool, the primary motivation for its development was so that Java applets and their requisite components (.class files, images and sounds) can be downloaded to a browser in a single HTTP transaction, rather than opening a new connection for each piece. This greatly improves the speed with which an applet can be loaded onto a web page and begin functioning. The JAR format also supports compression, which reduces the size of the file and improves download time still further. Additionally, individual entries in a JAR file may be digitally signed by the applet author to authenticate their origin.

JAR은 Java ARchive를 뜻한다.

-> 주된 목표 : Java applets and their requisite components(.class files, images and sounds)가 한 번의 HTTP transaction으로 browser에 다운로드 될 수 있도록 하는 거다. 덩어리로 있으면 한 번에 다운로드하면 되고 일일히 안의 요소들을 여러번 다운로드 할 필요가 사라진다.

그럼 JAVA Applet은 무엇인가?[2]

An applet is a Java™ program designed to be included in an HTML Web document. You can write your Java applet and include it in an HTML page, much in the same way an image is included. When you use a Java-enabled browser to view an HTML page that contains an applet, the applet's code is transferred to your system and is run by the browser's Java virtual machine.

HTML에 포함되도록 제작된 Java Program이다. 쉽게 표현해서 JAR이 HTML WEB DOCUMENT 상에서 포함/실행 가능하도록 만들어 준다.

그럼 어떤 방식으로 Applet이 작동하는가?[1]

Changing the APPLET tag in your HTML page to accomodate a JAR file is simple. The JAR file on the server is identified by the ARCHIVE parameter, where the directory location of the jar file should be relative to the location of the html page:

<applet code=Animator.class 
      archive="jars/animator.jar"
      width=460 height=160>
      <param name=foo value="bar">
    </applet>

JAR를 사용하는 예시를 하나 생각해보자.

  1. Samsung Knox -> 물론 HTML 상에서 작동하는 케이스는 아니지만 그래도 knoxsdk.jar를 안드로이드 프로젝트 lib폴더에 추가시켜서 사용한다.

  2. Spring IO -> Spring 어플리케이션을 제작할 때 jar 형태로 만들어서 운영한다.

글 읽어보시고 QnA 및 수정 비판 사항 얼마든지 환영입니다!

댓글로 많이 남겨주세요~

참조자료

  1. JAR File Overview - Oracle

  2. Java applets and applications - IBM

profile
Hello, My name is JaeYeon Won and I'm studying software development.

0개의 댓글