# [Bash] 터미널 jar 파일 생성

 

1. java 파일 생성

# cat Hello.java 
public class Hello {
  public static void main(String args[]){
    System.out.println("hello world");
  }
}

 

2. 컴파일

# javac Hello.java

 

3. manifest.txt 파일 생성

# cat manifest.txt 
Main-class: Hello

※ manifest.txt 파일이란? jar로 패키지된 파일 구성요소의 메타 정보를 가지고 있는 파일이다.

 

4. jar 파일 생성

# jar -cvmf manifest.txt hello.jar Hello.class 
Manifest를 추가함
추가하는 중: Hello.class(입력 = 415) (출력 = 286)(31%를 감소함)

 

5. jar 파일 실행

# java -jar hello.jar 
hello world

To be continued.........

 

 

Made by 꿩

 

'IT > Bash' 카테고리의 다른 글

[Python] Database connection  (0) 2022.05.09
[Linux] SSH 공개키 설정  (0) 2022.03.28
[Bash] 스크립트 #! 의미  (0) 2021.10.19
[centos] java openjdk 설치 및 삭제  (0) 2021.10.05
Redis 메모리 & 시간 측정 스크립트  (0) 2021.05.14

+ Recent posts