SDKMANを使ってJRE / JDKをインストールする手順。
curl -s "https://get.sdkman.io" | bash # ... # All done! # # Please open a new terminal, or run the following in the existing one: # # source "/Users/username/.sdkman/bin/sdkman-init.sh" # # Then issue the following command: # # sdk help # # Enjoy!!!
新しいターミナルを開くなりし、SDKMANを初期化する。
sdk version # # SDKMAN 5.7.3+337
たとえばAndroid開発では標準でJDK 8系が用いられたり、JavaでGUI開発をするならJava FXの含まれたものにする必要がある。
sdk list java # ================================================================================ # Available Java Versions # ================================================================================ # 13.ea.19-open 10.0.2-zulu 1.0.0-rc-15-grl # 12.0.1-sapmchn 10.0.2-open 1.0.0-rc-14-grl # 12.0.1-zulu 9.0.7-zulu # 12.0.1-open 9.0.4-open # 12.0.1.j9-adpt 8.0.212-zulu # 12.0.1.hs-adpt 8.0.212-amzn # 12.0.1-librca 8.0.212.j9-adpt # 11.0.3-sapmchn 8.0.212.hs-adpt # 11.0.3-zulu 8.0.212-librca # 11.0.3-amzn 8.0.202-zulu # 11.0.3.j9-adpt 8.0.202-amzn # 11.0.3.hs-adpt 8.0.202-zulufx # 11.0.3-librca 7.0.222-zulu # 11.0.2-open 7.0.181-zulu # 11.0.2-zulufx 1.0.0-rc-16-grl # ================================================================================ # + - local version # * - installed # > - currently in use # ================================================================================
今回は 8.0.202-amzn
を使うことにした。
sdk install java 8.0.202-amzn # # Downloading: java 8.0.202-amzn # ... # Done installing! # # Setting java 8.0.202-amzn as default.
必要に応じて。PATHが通るバイナリが切り替わる。
sdk default java 8.0.202-amzn # Default java version set to 8.0.202-amzn sdk current java # Using java version 8.0.202-amzn which java # /Users/username/.sdkman/candidates/java/current/bin/java java -version # openjdk version "1.8.0_202" # OpenJDK Runtime Environment Corretto-8.202.08.2 (build 1.8.0_202-b08) # OpenJDK 64-Bit Server VM Corretto-8.202.08.2 (build 25.202-b08, mixed mode)