헤르메스 LIFE

[SDKMAN] JDK 버전을 관리하는 Tool 이라고 합니다. 본문

Core Java

[SDKMAN] JDK 버전을 관리하는 Tool 이라고 합니다.

헤르메스의날개 2024. 2. 4. 10:30
728x90

JDK의 버전을 관리해주는 Tool 있다고 합니다.

SDKMAN

https://sdkman.io/

 

Home - SDKMAN! the Software Development Kit Manager

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems.

sdkman.io

https://sdkman.io/install

 

Installation - SDKMAN! the Software Development Kit Manager

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems.

sdkman.io


1. SDK 설치

# SDK 설치
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk version

# 설치가 잘 안된 경우 삭제 후 다시 설치하시면 됩니다.
$ rm -rf ~/.sdkman

# SDK 버전 확인
$ sdk version

SDKMAN!
script: 5.18.2
native: 0.4.6

혹시 unzip 과 zip 이 설치되어 있지 않다면...

# wls의 경우 zip, unzip 이 설치되어 있지 않습니다.
# jdk 의 경우도 환경문제로 일반적이지 않습니다.
$ sudo apt-get install unzip
$ sudo apt-get install zip

2. 설치할 수 있는 Java 버전 목록 확인

# 설치할 수 있는 Java 버전 목록
$ sdk list java
================================================================================
Available Java Versions for Linux 64bit
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
 Corretto      |     | 21.0.2       | amzn    |            | 21.0.2-amzn         
               |     | 21.0.1       | amzn    |            | 21.0.1-amzn         
               |     | 17.0.10      | amzn    |            | 17.0.10-amzn        
               |     | 17.0.9       | amzn    |            | 17.0.9-amzn         
               |     | 11.0.22      | amzn    |            | 11.0.22-amzn        
               |     | 11.0.21      | amzn    |            | 11.0.21-amzn        
               |     | 8.0.402      | amzn    |            | 8.0.402-amzn        
               |     | 8.0.392      | amzn    |            | 8.0.392-amzn        
 Dragonwell    |     | 17.0.9       | albba   |            | 17.0.9-albba        
               |     | 11.0.21      | albba   |            | 11.0.21-albba       
               |     | 11.0.20      | albba   |            | 11.0.20-albba       
               |     | 8.0.392      | albba   |            | 8.0.392-albba       
               |     | 8.0.382      | albba   |            | 8.0.382-albba       
 Gluon         |     | 22.1.0.1.r17 | gln     |            | 22.1.0.1.r17-gln    
               |     | 22.1.0.1.r11 | gln     |            | 22.1.0.1.r11-gln    
 GraalVM CE    |     | 21.0.2       | graalce |            | 21.0.2-graalce      
               |     | 21.0.1       | graalce |            | 21.0.1-graalce      
               |     | 17.0.9       | graalce |            | 17.0.9-graalce      
 GraalVM Oracle|     | 21.0.2       | graal   |            | 21.0.2-graal        
               |     | 21.0.1       | graal   |            | 21.0.1-graal        
               |     | 17.0.10      | graal   |            | 17.0.10-graal       
               |     | 17.0.9       | graal   |            | 17.0.9-graal        
 Java.net      |     | 23.ea.7      | open    |            | 23.ea.7-open        
               |     | 23.ea.6      | open    |            | 23.ea.6-open        
               |     | 23.ea.5      | open    |            | 23.ea.5-open        
               |     | 23.ea.4      | open    |            | 23.ea.4-open        
               |     | 23.ea.3      | open    |            | 23.ea.3-open        
               |     | 23.ea.2      | open    |            | 23.ea.2-open        
               |     | 23.ea.1      | open    |            | 23.ea.1-open        
               |     | 22.ea.33     | open    |            | 22.ea.33-open       
               |     | 22.ea.32     | open    |            | 22.ea.32-open       
               |     | 22.ea.31     | open    |            | 22.ea.31-open       
               |     | 22.ea.30     | open    |            | 22.ea.30-open       
               |     | 22.ea.29     | open    |            | 22.ea.29-open       
               |     | 22.ea.28     | open    |            | 22.ea.28-open       
               |     | 22.ea.27     | open    |            | 22.ea.27-open       
               |     | 22.ea.26     | open    |            | 22.ea.26-open       
               |     | 21.ea.35     | open    |            | 21.ea.35-open
               |     | 21.0.2       | open    |            | 21.0.2-open         
 JetBrains     |     | 17.0.10      | jbr     |            | 17.0.10-jbr         
               |     | 17.0.9       | jbr     |            | 17.0.9-jbr          
               |     | 11.0.14.1    | jbr     |            | 11.0.14.1-jbr       
 Liberica      |     | 21.0.2.crac  | librca  |            | 21.0.2.crac-librca  
               |     | 21.0.2.fx    | librca  |            | 21.0.2.fx-librca    
               |     | 21.0.2       | librca  |            | 21.0.2-librca       
               |     | 21.0.1.crac  | librca  |            | 21.0.1.crac-librca  
               |     | 21.0.1.fx    | librca  |            | 21.0.1.fx-librca    
               |     | 21.0.1       | librca  |            | 21.0.1-librca       
               |     | 17.0.10.crac | librca  |            | 17.0.10.crac-librca 
               |     | 17.0.10.fx   | librca  |            | 17.0.10.fx-librca   
               |     | 17.0.10      | librca  |            | 17.0.10-librca      
               |     | 17.0.9.crac  | librca  |            | 17.0.9.crac-librca  
               |     | 17.0.9.fx    | librca  |            | 17.0.9.fx-librca    
               |     | 17.0.9       | librca  |            | 17.0.9-librca       
               |     | 11.0.22.fx   | librca  |            | 11.0.22.fx-librca   
               |     | 11.0.22      | librca  |            | 11.0.22-librca      
               |     | 11.0.21.fx   | librca  |            | 11.0.21.fx-librca   
               |     | 11.0.21      | librca  |            | 11.0.21-librca      
               |     | 8.0.402.fx   | librca  |            | 8.0.402.fx-librca   
               |     | 8.0.402      | librca  |            | 8.0.402-librca      
               |     | 8.0.392.fx   | librca  |            | 8.0.392.fx-librca   
               |     | 8.0.392      | librca  |            | 8.0.392-librca      
 Liberica NIK  |     | 23.1.2.r21   | nik     |            | 23.1.2.r21-nik      
               |     | 23.1.1.r21   | nik     |            | 23.1.1.r21-nik      
               |     | 23.0.3.r17   | nik     |            | 23.0.3.r17-nik      
               |     | 22.3.5.r17   | nik     |            | 22.3.5.r17-nik      
               |     | 22.3.5.r11   | nik     |            | 22.3.5.r11-nik      
               |     | 22.3.4.r17   | nik     |            | 22.3.4.r17-nik      
               |     | 22.3.4.r11   | nik     |            | 22.3.4.r11-nik      
 Mandrel       |     | 23.1.2.r21   | mandrel |            | 23.1.2.r21-mandrel  
               |     | 23.1.1.r21   | mandrel |            | 23.1.1.r21-mandrel  
               |     | 23.0.3.r17   | mandrel |            | 23.0.3.r17-mandrel  
               |     | 22.3.5.r17   | mandrel |            | 22.3.5.r17-mandrel  
 Microsoft     |     | 21.0.2       | ms      |            | 21.0.2-ms           
               |     | 21.0.1       | ms      |            | 21.0.1-ms           
               |     | 17.0.10      | ms      |            | 17.0.10-ms          
               |     | 17.0.9       | ms      |            | 17.0.9-ms           
               |     | 11.0.22      | ms      |            | 11.0.22-ms
               |     | 11.0.21      | ms      |            | 11.0.21-ms          
 Oracle        |     | 21.0.2       | oracle  |            | 21.0.2-oracle       
               |     | 21.0.1       | oracle  |            | 21.0.1-oracle       
               |     | 17.0.10      | oracle  |            | 17.0.10-oracle      
               |     | 17.0.9       | oracle  |            | 17.0.9-oracle       
 SapMachine    |     | 21.0.2       | sapmchn |            | 21.0.2-sapmchn      
               |     | 21.0.1       | sapmchn |            | 21.0.1-sapmchn      
               |     | 17.0.10      | sapmchn |            | 17.0.10-sapmchn     
               |     | 17.0.9       | sapmchn |            | 17.0.9-sapmchn      
               |     | 11.0.22      | sapmchn |            | 11.0.22-sapmchn     
               |     | 11.0.21      | sapmchn |            | 11.0.21-sapmchn     
 Semeru        |     | 21.0.1       | sem     |            | 21.0.1-sem          
               |     | 17.0.9       | sem     |            | 17.0.9-sem          
               |     | 11.0.21      | sem     |            | 11.0.21-sem         
               |     | 8.0.392      | sem     |            | 8.0.392-sem         
 Temurin       |     | 21.0.2       | tem     |            | 21.0.2-tem          
               |     | 21.0.1       | tem     |            | 21.0.1-tem          
               |     | 17.0.10      | tem     |            | 17.0.10-tem         
               |     | 17.0.9       | tem     |            | 17.0.9-tem          
               |     | 11.0.22      | tem     |            | 11.0.22-tem         
               |     | 11.0.21      | tem     |            | 11.0.21-tem         
               |     | 8.0.402      | tem     |            | 8.0.402-tem         
               |     | 8.0.392      | tem     |            | 8.0.392-tem         
 Tencent       |     | 17.0.10      | kona    |            | 17.0.10-kona        
               |     | 17.0.9       | kona    |            | 17.0.9-kona         
               |     | 11.0.22      | kona    |            | 11.0.22-kona        
               |     | 11.0.21      | kona    |            | 11.0.21-kona        
               |     | 8.0.402      | kona    |            | 8.0.402-kona        
               |     | 8.0.392      | kona    |            | 8.0.392-kona        
 Trava         |     | 11.0.15      | trava   |            | 11.0.15-trava       
               |     | 8.0.282      | trava   |            | 8.0.282-trava       
 Zulu          |     | 21.0.2       | zulu    |            | 21.0.2-zulu         
               |     | 21.0.2.crac  | zulu    |            | 21.0.2.crac-zulu    
               |     | 21.0.2.fx    | zulu    |            | 21.0.2.fx-zulu      
               |     | 21.0.1       | zulu    |            | 21.0.1-zulu         
               |     | 21.0.1.crac  | zulu    |            | 21.0.1.crac-zulu    
               |     | 21.0.1.fx    | zulu    |            | 21.0.1.fx-zulu
               |     | 21.0.1       | zulu    |            | 21.0.1-zulu         
               |     | 21.0.1.crac  | zulu    |            | 21.0.1.crac-zulu    
               |     | 21.0.1.fx    | zulu    |            | 21.0.1.fx-zulu      
               |     | 17.0.10      | zulu    |            | 17.0.10-zulu        
               |     | 17.0.10.fx   | zulu    |            | 17.0.10.fx-zulu     
               |     | 17.0.9       | zulu    |            | 17.0.9-zulu         
               |     | 17.0.9.crac  | zulu    |            | 17.0.9.crac-zulu    
               |     | 17.0.9.fx    | zulu    |            | 17.0.9.fx-zulu      
               |     | 11.0.22      | zulu    |            | 11.0.22-zulu        
               |     | 11.0.22.fx   | zulu    |            | 11.0.22.fx-zulu     
               |     | 11.0.21      | zulu    |            | 11.0.21-zulu        
               |     | 11.0.21.fx   | zulu    |            | 11.0.21.fx-zulu     
               |     | 8.0.402      | zulu    |            | 8.0.402-zulu        
               |     | 8.0.402.fx   | zulu    |            | 8.0.402.fx-zulu     
               |     | 8.0.392      | zulu    |            | 8.0.392-zulu        
               |     | 8.0.392.fx   | zulu    |            | 8.0.392.fx-zulu     
               |     | 7.0.352      | zulu    |            | 7.0.352-zulu        
               |     | 6.0.119      | zulu    |            | 6.0.119-zulu        
================================================================================
Omit Identifier to install default version 21.0.2-tem:
    $ sdk install java
Use TAB completion to discover available versions
    $ sdk install java [TAB]
Or install a specific version by Identifier:
    $ sdk install java 21.0.2-tem
Hit Q to exit this list view
================================================================================

3. JDK 설치

전 Zulu 버전을 설치할 예정입니다.

zulu 버전은 두 가지가 있네요. [버전]-zulu 와 [버전].fx-zulu 

fx 가 붙은 버전은 JavaFX가 포함된 버전이라고 합니다.

# zulu 11.0.22 버전 설치
$ sdk install java 11.0.22-zulu

Downloading: java 11.0.22-zulu

In progress...

##################################################################################################### 100.0%

Repackaging Java 11.0.22-zulu...

Done repackaging...

Installing: java 11.0.22-zulu
Done installing!


Setting java 11.0.22-zulu as default.

# zulu 8.0.402 버전 설치
$ sdk install java 8.0.402-zulu

Downloading: java 8.0.402-zulu

In progress...

##################################################################################################### 100.0%

Repackaging Java 8.0.402-zulu...

Done repackaging...

Installing: java 8.0.402-zulu
Done installing!

Do you want java 8.0.402-zulu to be set as default? (Y/n): n

# zulu 17.0.10-zulu 버전 설치
$ sdk install java 17.0.10-zulu

Downloading: java 17.0.10-zulu

In progress...

################################################################################################################# 100.0%

Repackaging Java 17.0.10-zulu...

Done repackaging...

Installing: java 17.0.10-zulu
Done installing!


Setting java 17.0.10-zulu as default.

apt 로 설치된 JDK의 디렉토리 경로는 '/usr/lib/jvm/' 입니다.

sdk로 설치된 디렉토리 경로는 '~/.sdkman/candidates/java/' 입니다.

# 설치할 수 있는 목록과 설치된 목록을 확인 할 수 있습니다.
$ sdk list java
 Zulu          |     | 21.0.2       | zulu    |            | 21.0.2-zulu         
               |     | 21.0.2.crac  | zulu    |            | 21.0.2.crac-zulu    
               |     | 21.0.2.fx    | zulu    |            | 21.0.2.fx-zulu      
               |     | 21.0.1       | zulu    |            | 21.0.1-zulu         
               |     | 21.0.1.crac  | zulu    |            | 21.0.1.crac-zulu    
               |     | 21.0.1.fx    | zulu    |            | 21.0.1.fx-zulu      
               |     | 17.0.10      | zulu    |            | 17.0.10-zulu        
               |     | 17.0.10.fx   | zulu    |            | 17.0.10.fx-zulu     
               |     | 17.0.9       | zulu    |            | 17.0.9-zulu         
               |     | 17.0.9.crac  | zulu    |            | 17.0.9.crac-zulu    
               |     | 17.0.9.fx    | zulu    |            | 17.0.9.fx-zulu      
               | >>> | 11.0.22      | zulu    | installed  | 11.0.22-zulu        
               |     | 11.0.22.fx   | zulu    |            | 11.0.22.fx-zulu     
               |     | 11.0.21      | zulu    |            | 11.0.21-zulu        
               |     | 11.0.21.fx   | zulu    |            | 11.0.21.fx-zulu     
               |     | 8.0.402      | zulu    | installed  | 8.0.402-zulu        
               |     | 8.0.402.fx   | zulu    |            | 8.0.402.fx-zulu     
               |     | 8.0.392      | zulu    |            | 8.0.392-zulu        
               |     | 8.0.392.fx   | zulu    |            | 8.0.392.fx-zulu     
               |     | 7.0.352      | zulu    |            | 7.0.352-zulu        
               |     | 6.0.119      | zulu    |            | 6.0.119-zulu

4. JDK 삭제

sdk uninstall java 11.0.22-zulu

5. 설치된 JDK 변경

# JDK 변경
$ sdk use java 11.0.22-zulu

# 현재 사용 버전 확인
$ sdk current

Using:

java: 11.0.22-zulu

6. Default 버전 설정

# Default 버전 설정
$ sdk default java 11.0.22-zulu

7. 업그레이드

# 버전 업그레이드
$ sdk upgrade java

Available defaults:
java (local: 8.0.402-zulu, 11.0.22-zulu; default: 21.0.2-tem)

Use prescribed default version(s)? (Y/n): n

 


출처 : SDK 관련 설명이 너무 잘되어 있어서 저도 따라서 설치했어요. ^^

Facebook 계정이 없어서 댓글을 못 달아 드렸네요.

이 글을 통해 감사드립니다.

https://phoby.github.io/sdkman/

 

SDK! 으로 Java 버전 관리하기

SDKMAN!SDMMAN!은 대부분의 유닉스 기반 시스템에서 여러가지 SDK(Software Development Kits)의 병렬 버전을 관리하기 위한 도구입니다.

phoby.github.io

 

728x90