=================
== The Archive ==
=================

SDKMAN! 으로 다중 JDK 관리하기 (migrating from jEnv)

|

개요

기존 다중 JDK 관리했던 방법 (Homebrew + jEnv)

기존 관리 방법의 문제점

SDKMAN! 으로 옮기기

jEnv 설정 제거하기

1
2
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
1
2
❯ brew uninstall jenv
Uninstalling /opt/homebrew/Cellar/jenv/0.5.7... (86 files, 78.1KB)
1
❯ rm -rf ~/.jenv

/Library/Java/JavaVirtualMachines 경로에 심볼릭 링크 모두 제거

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
~                                                                      13:04:45
❯ ls -altr /Library/Java/JavaVirtualMachines
total 0
lrwxr-xr-x  1 root  wheel   48 May  5  2022 openjdk-17.jdk -> /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk
lrwxr-xr-x  1 root  wheel   48 Jun 20  2022 openjdk-11.jdk -> /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk
lrwxr-xr-x  1 root  wheel   48 Sep 21  2024 openjdk-23.jdk -> /opt/homebrew/opt/openjdk@23/libexec/openjdk.jdk
drwxr-xr-x  4 root  wheel  128 May  4 14:39 ..
lrwxr-xr-x  1 root  wheel   48 May 11 03:37 openjdk-21.jdk -> /opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk
drwxr-xr-x  6 root  wheel  192 May 20 04:55 .

~                                                                      13:05:10
❯ sudo rm -rf /Library/Java/JavaVirtualMachines/openjdk-*
Password:

~                                                                      13:05:43
❯ ls -altr /Library/Java/JavaVirtualMachines
total 0
drwxr-xr-x  4 root  wheel  128 May  4 14:39 ..
drwxr-xr-x  2 root  wheel   64 May 25 13:05 .

Homebrew 로 설치한 JDK 모두 지우기

1
2
3
4
5
❯ brew list | grep jdk
openjdk
openjdk@11
openjdk@17
openjdk@21
1
2
3
4
5
❯ brew uninstall openjdk openjdk@11 openjdk@17 openjdk@21
Error: Refusing to uninstall /opt/homebrew/Cellar/openjdk/23.0.2
because it is required by clojure, gradle, kotlin, leiningen and maven, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies openjdk openjdk@11 openjdk@17 openjdk@21
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
~                                                                      13:07:51
❯ brew uninstall clojure
Uninstalling /opt/homebrew/Cellar/clojure/1.12.0.1530... (14 files, 16.5MB)
==> Autoremoving 1 unneeded formula:
rlwrap
Uninstalling /opt/homebrew/Cellar/rlwrap/0.46.2... (46 files, 416.7KB)

~                                                                      13:09:02
❯ brew uninstall gradle
Uninstalling /opt/homebrew/Cellar/gradle/8.14.1... (22,433 files, 440.2MB)

~                                                                      13:09:13
❯ brew uninstall kotlin
Uninstalling /opt/homebrew/Cellar/kotlin/2.1.21... (126 files, 90.0MB)

~                                                                      13:09:21
❯ brew uninstall leiningen
Uninstalling /opt/homebrew/Cellar/leiningen/2.11.2... (10 files, 15.8MB)

~                                                                      13:09:32
❯ brew uninstall maven
Uninstalling /opt/homebrew/Cellar/maven/3.9.9... (94 files, 10.2MB)
==> Autoremoving 3 unneeded formulae:
icu4c@76
openjdk
python@3.12
Uninstalling /opt/homebrew/Cellar/python@3.12/3.12.10_1... (3,598 files, 67MB)
Uninstalling /opt/homebrew/Cellar/openjdk/23.0.2... (602 files, 337.4MB)
Uninstalling /opt/homebrew/Cellar/icu4c@76/76.1_2... (277 files, 81MB)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
~                                                                      13:09:41
❯ brew uninstall openjdk openjdk@11 openjdk@17 openjdk@21
Error: No such keg: /opt/homebrew/Cellar/openjdk

~                                                                      13:10:11
❯ brew uninstall openjdk@11 openjdk@17 openjdk@21
Uninstalling /opt/homebrew/Cellar/openjdk@11/11.0.27... (667 files, 296MB)
Uninstalling /opt/homebrew/Cellar/openjdk@17/17.0.15... (636 files, 305MB)
Uninstalling /opt/homebrew/Cellar/openjdk@21/21.0.7... (600 files, 331MB)
==> Autoremoving 14 unneeded formulae:
cairo
fontconfig
freetype
giflib
graphite2
harfbuzz
libx11
libxau
libxcb
libxdmcp
libxext
libxrender
little-cms2
xorgproto
Uninstalling /opt/homebrew/Cellar/little-cms2/2.17... (23 files, 1.4MB)
Uninstalling /opt/homebrew/Cellar/harfbuzz/11.2.1... (77 files, 10.2MB)
Uninstalling /opt/homebrew/Cellar/giflib/5.2.2... (19 files, 544.5KB)
Uninstalling /opt/homebrew/Cellar/graphite2/1.3.14... (18 files, 280.6KB)
Uninstalling /opt/homebrew/Cellar/cairo/1.18.4... (53 files, 2.2MB)
Uninstalling /opt/homebrew/Cellar/fontconfig/2.16.0... (92 files, 1.5MB)
Uninstalling /opt/homebrew/Cellar/libxrender/0.9.12... (13 files, 225.3KB)
Uninstalling /opt/homebrew/Cellar/libxext/1.3.6... (87 files, 450.9KB)
Uninstalling /opt/homebrew/Cellar/freetype/2.13.3... (68 files, 2.5MB)
Uninstalling /opt/homebrew/Cellar/libx11/1.8.12... (1,043 files, 7MB)
Uninstalling /opt/homebrew/Cellar/libxcb/1.17.0... (2,497 files, 7.5MB)
Uninstalling /opt/homebrew/Cellar/libxau/1.0.12... (21 files, 134.4KB)
Uninstalling /opt/homebrew/Cellar/libxdmcp/1.1.5... (11 files, 136.4KB)
Uninstalling /opt/homebrew/Cellar/xorgproto/2024.1... (267 files, 3.9MB)

SDKMAN! 설치하기

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
❯ curl -s "https://get.sdkman.io" | bash

                                -+syyyyyyys:
                            `/yho:`       -yd.
                         `/yh/`             +m.
                       .oho.                 hy                          .`
                     .sh/`                   :N`                `-/o`  `+dyyo:.
                   .yh:`                     `M-          `-/osysoym  :hs` `-+sys:      hhyssssssssy+
                 .sh:`                       `N:          ms/-``  yy.yh-      -hy.    `.N-````````+N.
               `od/`                         `N-       -/oM-      ddd+`     `sd:     hNNm        -N:
              :do`                           .M.       dMMM-     `ms.      /d+`     `NMMs       `do
            .yy-                             :N`    ```mMMM.      -      -hy.       /MMM:       yh
          `+d+`           `:/oo/`       `-/osyh/ossssssdNMM`           .sh:         yMMN`      /m.
         -dh-           :ymNMMMMy  `-/shmNm-`:N/-.``   `.sN            /N-         `NMMy      .m/
       `oNs`          -hysosmMMMMydmNmds+-.:ohm           :             sd`        :MMM/      yy
      .hN+           /d:    -MMMmhs/-.`   .MMMh   .ss+-                 `yy`       sMMN`     :N.
     :mN/           `N/     `o/-`         :MMMo   +MMMN-         .`      `ds       mMMh      do
    /NN/            `N+....--:/+oooosooo+:sMMM:   hMMMM:        `my       .m+     -MMM+     :N.
   /NMo              -+ooooo+/:-....`...:+hNMN.  `NMMMd`        .MM/       -m:    oMMN.     hs
  -NMd`                                    :mm   -MMMm- .s/     -MMm.       /m-   mMMd     -N.
 `mMM/                                      .-   /MMh. -dMo     -MMMy        od. .MMMs..---yh
 +MMM.                                           sNo`.sNMM+     :MMMM/        sh`+MMMNmNm+++-
 mMMM-                                           /--ohmMMM+     :MMMMm.       `hyymmmdddo
 MMMMh.                  ````                  `-+yy/`yMMM/     :MMMMMy       -sm:.``..-:-.`
 dMMMMmo-.``````..-:/osyhddddho.           `+shdh+.   hMMM:     :MmMMMM/   ./yy/` `:sys+/+sh/
 .dMMMMMMmdddddmmNMMMNNNNNMMMMMs           sNdo-      dMMM-  `-/yd/MMMMm-:sy+.   :hs-      /N`
  `/ymNNNNNNNmmdys+/::----/dMMm:          +m-         mMMM+ohmo/.` sMMMMdo-    .om:       `sh
     `.-----+/.`       `.-+hh/`         `od.          NMMNmds/     `mmy:`     +mMy      `:yy.
           /moyso+//+ossso:.           .yy`          `dy+:`         ..       :MMMN+---/oys:
         /+m:  `.-:::-`               /d+                                    +MMMMMMMNh:`
        +MN/                        -yh.                                     `+hddhy+.
       /MM+                       .sh:
      :NMo                      -sh/
     -NMs                    `/yy:
    .NMy                  `:sh+.
   `mMm`               ./yds-
  `dMMMmyo:-.````.-:oymNy:`
  +NMMMMMMMMMMMMMMMMms:`
    -+shmNMMMNmdy+:`

                                                                 Now attempting installation...

Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for tar...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime platform file...
Prime the config file...
Installing script cli archive...
* Downloading...
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...

Installing script cli archive...
* Downloading...
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...

Set version to 5.19.0 ...
Set native version to 0.7.4 ...
Attempt update of login bash profile on OSX...
Attempt update of zsh profile...
Updated existing /Users/bossm0n5t3r/.zshrc

All done!

You are subscribed to the STABLE channel.

Please open a new terminal, or run the following in the existing one:

    source "/Users/bossm0n5t3r/.sdkman/bin/sdkman-init.sh"

Then issue the following command:

    sdk help

Enjoy!!!
1
2
3
4
5
❯ sdk version

SDKMAN!
script: 5.19.0
native: 0.7.4 (macos aarch64)

SDKMAN! 를 업데이트 하는 방법

1
sdk selfupdate

SDKMAN! 으로 설치한 JDK, SDK 업데이트 하는 방법

1
2
3
4
5
WARNING: SDKMAN is out-of-date and requires an update.

sdk update

Adding new candidates(s): kotlin

SDKMAN! 을 완전히 지우는 방법

기존에 설치했던 JVM 및 여러 도구 모두 설치하기

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
~                                                                      13:11:40
❯ sdk install kotlin

Downloading: kotlin 2.1.21

In progress...

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

Installing: kotlin 2.1.21
Done installing!

Setting kotlin 2.1.21 as default.

~                                                                  14s 13:13:24
❯ sdk install gradle

Downloading: gradle 8.14.1

In progress...

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

Installing: gradle 8.14.1
Done installing!

Setting gradle 8.14.1 as default.

~                                                                  19s 13:13:49
❯ sdk install java

Downloading: java 21.0.7-tem

In progress...

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

Repackaging Java 21.0.7-tem...

Done repackaging...
Cleaning up residual files...

Installing: java 21.0.7-tem
Done installing!

Setting java 21.0.7-tem as default.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
❯ kotlinc -version
info: kotlinc-jvm 2.1.21 (JRE 21.0.7+6-LTS)

~                                                                      13:19:31
❯ gradle --version

Welcome to Gradle 8.14.1!

Here are the highlights of this release:
 - Java 24 support
 - GraalVM Native Image toolchain selection
 - Enhancements to test reporting
 - Build Authoring improvements

For more details see https://docs.gradle.org/8.14.1/release-notes.html

------------------------------------------------------------
Gradle 8.14.1
------------------------------------------------------------

Build time:    2025-05-22 13:44:09 UTC
Revision:      c174b82566a79e3575bac8c7648c7b36cd815e94

Kotlin:        2.0.21
Groovy:        3.0.24
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  21.0.7 (Azul Systems, Inc. 21.0.7+6-LTS)
Daemon JVM:    /Users/bossm0n5t3r/Library/Java/JavaVirtualMachines/azul-21.0.7/Contents/Home (no JDK specified, using current Java home)
OS:            Mac OS X 15.5 aarch64

~                                                                      13:19:40
❯ java --version
openjdk 21.0.7 2025-04-15 LTS
OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)

SDKMAN! 프로젝트 별 설정

IntelliJ 에서 JDK 관리 업데이트

결론

Categories:

Tags: