たぶん @yamadamn さんが既にやっているやつ。
調べることにした経緯は、 aws amplify cli のバージョンチェックがおかしいため。
上記のチェックでは、 java -version
の結果が /(\d+\.)(\d+\.)(\d)/g
にマッチすることを前提にしているが、どうやら java のバージョンが 14.0.0
のようなケースだとバージョンが 14
のような形になるケースが見られる。実際に確かめてみるべく、ローカルにインストールされているすべての java のバージョンについて java -version
を実行してみた
while read version ; do sdk u java "${version}" printf "\n%s\n" "${version}" java -version done < <(sdk l java | grep -E '(installed|local only)' | grep -v '6u65' | awk '{print $NF}')
結果
Using java version 11.0.8-amzn in this shell. 11.0.8-amzn Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "11.0.8" 2020-07-14 LTS OpenJDK Runtime Environment Corretto-11.0.8.10.1 (build 11.0.8+10-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.8.10.1 (build 11.0.8+10-LTS, mixed mode) Using java version 8.0.265-amzn in this shell. 8.0.265-amzn Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_265" OpenJDK Runtime Environment Corretto-8.265.01.1 (build 1.8.0_265-b01) OpenJDK 64-Bit Server VM Corretto-8.265.01.1 (build 25.265-b01, mixed mode) Using java version 13.0.2-zulu in this shell. 13.0.2-zulu Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "13.0.2" 2020-01-14 OpenJDK Runtime Environment Zulu13.29+9-CA (build 13.0.2+6-MTS) OpenJDK 64-Bit Server VM Zulu13.29+9-CA (build 13.0.2+6-MTS, mixed mode, sharing) Using java version 11.0.1-zulu in this shell. 11.0.1-zulu Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "11.0.1" 2018-10-16 LTS OpenJDK Runtime Environment Zulu11.2+3 (build 11.0.1+13-LTS) OpenJDK 64-Bit Server VM Zulu11.2+3 (build 11.0.1+13-LTS, mixed mode) Using java version 8.0.202-zulu in this shell. 8.0.202-zulu Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_202" OpenJDK Runtime Environment (Zulu 8.36.0.1-CA-macosx) (build 1.8.0_202-b05) OpenJDK 64-Bit Server VM (Zulu 8.36.0.1-CA-macosx) (build 25.202-b05, mixed mode) Using java version 11.0.3-librca in this shell. 11.0.3-librca Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "11.0.3-BellSoft" 2019-04-16 LibericaJDK Runtime Environment (build 11.0.3-BellSoft+12) LibericaJDK 64-Bit Server VM (build 11.0.3-BellSoft+12, mixed mode) Using java version 20.1.0.r11-grl in this shell. 20.1.0.r11-grl Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "11.0.7" 2020-04-14 OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02) OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing) Using java version 20.1.0.r8-grl in this shell. 20.1.0.r8-grl Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_252" OpenJDK Runtime Environment (build 1.8.0_252-b09) OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 25.252-b09-jvmci-20.1-b02, mixed mode) Using java version 20.0.0.r11-grl in this shell. 20.0.0.r11-grl Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "11.0.6" 2020-01-14 OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02) OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing) Using java version 20.0.0.r8-grl in this shell. 20.0.0.r8-grl Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_242" OpenJDK Runtime Environment (build 1.8.0_242-b06) OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 25.242-b06-jvmci-20.0-b02, mixed mode) Using java version 19.3.0.2.r11-grl in this shell. 19.3.0.2.r11-grl Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "11.0.5" 2019-10-15 OpenJDK Runtime Environment GraalVM CE 19.3.0.2 (build 11.0.5+10-jvmci-19.3-b06) OpenJDK 64-Bit Server VM GraalVM CE 19.3.0.2 (build 11.0.5+10-jvmci-19.3-b06, mixed mode, sharing) Using java version 19.2.1-grl in this shell. 19.2.1-grl Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-20191009173705.graal.jdk8u-src-tar-gz-b07) OpenJDK 64-Bit GraalVM CE 19.2.1 (build 25.232-b07-jvmci-19.2-b03, mixed mode) Using java version 19.1.1-grl in this shell. 19.1.1-grl Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_222" OpenJDK Runtime Environment (build 1.8.0_222-20190711112007.graal.jdk8u-src-tar-gz-b08) OpenJDK 64-Bit GraalVM CE 19.1.1 (build 25.222-b08-jvmci-19.1-b01, mixed mode) Using java version 1.0.0-rc-10-grl in this shell. 1.0.0-rc-10-grl Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_192" OpenJDK Runtime Environment (build 1.8.0_192-20181024123616.buildslave.jdk8u-src-tar--b12) GraalVM 1.0.0-rc10 (build 25.192-b12-jvmci-0.53, mixed mode) Using java version 15.ea.36-open in this shell. 15.ea.36-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "15" 2020-09-15 OpenJDK Runtime Environment (build 15+36-1562) OpenJDK 64-Bit Server VM (build 15+36-1562, mixed mode, sharing) Using java version 14.ea.11-open in this shell. 14.ea.11-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "14-ea" 2020-03-17 OpenJDK Runtime Environment (build 14-ea+11-371) OpenJDK 64-Bit Server VM (build 14-ea+11-371, mixed mode, sharing) Using java version 14.0.0-open in this shell. 14.0.0-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "14" 2020-03-17 OpenJDK Runtime Environment (build 14+36-1461) OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing) Using java version 13.0.1-open in this shell. 13.0.1-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "13.0.1" 2019-10-15 OpenJDK Runtime Environment (build 13.0.1+9) OpenJDK 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing) Using java version 12.ea.31-open in this shell. 12.ea.31-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "12" 2019-03-19 OpenJDK Runtime Environment (build 12+31) OpenJDK 64-Bit Server VM (build 12+31, mixed mode, sharing) Using java version 12.0.1-open in this shell. 12.0.1-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "12.0.1" 2019-04-16 OpenJDK Runtime Environment (build 12.0.1+12) OpenJDK 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing) Using java version 12.0.0-open in this shell. 12.0.0-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "12" 2019-03-19 OpenJDK Runtime Environment (build 12+33) OpenJDK 64-Bit Server VM (build 12+33, mixed mode, sharing) Using java version 11.0.3-open in this shell. 11.0.3-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "11.0.3" 2019-04-16 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode) Using java version 11.0.0-open in this shell. 11.0.0-open Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode) Using java version 14.0.2-sapmchn in this shell. 14.0.2-sapmchn Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "14.0.2" 2020-07-15 OpenJDK Runtime Environment SapMachine (build 14.0.2+12-sapmachine) OpenJDK 64-Bit Server VM SapMachine (build 14.0.2+12-sapmachine, mixed mode, sharing) Using java version 12.0.2-sapmchn in this shell. 12.0.2-sapmchn Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "12.0.2" 2019-07-17 OpenJDK Runtime Environment (build 12.0.2+9-sapmachine) OpenJDK 64-Bit Server VM (build 12.0.2+9-sapmachine, mixed mode, sharing) Using java version 10u23-openjdk in this shell. 10u23-openjdk Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "10-internal" OpenJDK Runtime Environment (build 10-internal+0-adhoc.jenkins.openjdk) OpenJDK 64-Bit Server VM (build 10-internal+0-adhoc.jenkins.openjdk, mixed mode) Using java version 10.0.0-oracle in this shell. 10.0.0-oracle Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "10" 2018-03-20 Java(TM) SE Runtime Environment 18.3 (build 10+46) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode) Using java version 9ea170 in this shell. 9ea170 Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+170) Java HotSpot(TM) 64-Bit Server VM (build 9-ea+170, mixed mode) Using java version 9ea163 in this shell. 9ea163 Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+163) Java HotSpot(TM) 64-Bit Server VM (build 9-ea+163, mixed mode) Using java version 9.0.1-oracle in this shell. 9.0.1-oracle Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "9.0.1" Java(TM) SE Runtime Environment (build 9.0.1+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode) Using java version 8u161-oracle in this shell. 8u161-oracle Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode) Using java version 8u141-oracle in this shell. 8u141-oracle Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "1.8.0_141" Java(TM) SE Runtime Environment (build 1.8.0_141-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode) Using java version 8u131 in this shell. 8u131 Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) Using java version 8u111 in this shell. 8u111 Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode) Using java version 7u79 in this shell. 7u79 Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode) Using java version 1.0.0-rc9-graal in this shell. 1.0.0-rc9-graal Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_192" OpenJDK Runtime Environment (build 1.8.0_192-20181024123616.buildslave.jdk8u-src-tar--b12) GraalVM 1.0.0-rc9 (build 25.192-b12-jvmci-0.49, mixed mode) Using java version 1.0.0-rc5-graal in this shell. 1.0.0-rc5-graal Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8 openjdk version "1.8.0_172" OpenJDK Runtime Environment (build 1.8.0_172-20180626105433.graaluser.jdk8u-src-tar-g-b11) GraalVM 1.0.0-rc5 (build 25.71-b01-internal-jvmci-0.46, mixed mode)