AWS Cloud9でjdk11をセットアップする

PlatformはUbuntu Serverを選択する

AWSでCloud9環境を作成するときに、PlatformでUbuntu Serverを選択する。

Amazon Linuxではできなかった。。。

うまくできなかった点は下記

試したのは下記のバージョン

$ uname -a
 Linux ip-172-31-38-95 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/system-release
 Amazon Linux AMI release 2018.03

・yumでjdk11をインストール

java-11が存在しないと言われるので断念。Amazon Linuxの初期のバージョンは Java 1.7 だった。

$ sudo yum -y install java-11-openjdk java-11-openjdk-devel
 Loaded plugins: priorities, update-motd, upgrade-helper
 1065 packages excluded due to repository priority protections
 No package java-11-openjdk available.
 No package java-11-openjdk-devel available.
 Error: Nothing to do

・バイナリファイルを解凍

こちらの方法その3を参考に下記のリンクよりバイナルファイルを取得して、Cloud9にアップロードして、解凍を試みたが、エラーが出たため断念。

http://jdk.java.net/archive/

$ tar xzvf openjdk-11_linux-x64_bin.tar.gz
 jdk-11/bin/jaotc
 jdk-11/bin/jar
 jdk-11/bin/jarsigner
 jdk-11/bin/java
 jdk-11/bin/javac
 jdk-11/bin/javadoc
 jdk-11/bin/javap
 jdk-11/bin/jcmd
 jdk-11/bin/jconsole
 jdk-11/bin/jdb
 jdk-11/bin/jdeprscan
 jdk-11/bin/jdeps
 jdk-11/bin/jhsdb
 jdk-11/bin/jimage
 jdk-11/bin/jinfo
 jdk-11/bin/jjs
 jdk-11/bin/jlink
 jdk-11/bin/jmap
 jdk-11/bin/jmod
 jdk-11/bin/jps
 jdk-11/bin/jrunscript
 jdk-11/bin/jshell
 jdk-11/bin/jstack
 jdk-11/bin/jstat
 jdk-11/bin/jstatd
 jdk-11/bin/keytool
 jdk-11/bin/pack200
 jdk-11/bin/rmic
 jdk-11/bin/rmid
 jdk-11/bin/rmiregistry
 jdk-11/bin/serialver
 jdk-11/bin/unpack200
 jdk-11/conf/logging.properties
 jdk-11/conf/management/jmxremote.access
 jdk-11/conf/management/jmxremote.password.template
 jdk-11/conf/management/management.properties
 jdk-11/conf/net.properties
 jdk-11/conf/security/java.policy
 jdk-11/conf/security/java.security
 jdk-11/conf/security/policy/README.txt
 jdk-11/conf/security/policy/limited/default_US_export.policy
 jdk-11/conf/security/policy/limited/default_local.policy
 jdk-11/conf/security/policy/limited/exempt_local.policy
 jdk-11/conf/security/policy/unlimited/default_US_export.policy
 jdk-11/conf/security/policy/unlimited/default_local.policy
 jdk-11/conf/sound.properties
 jdk-11/include/classfile_constants.h
 jdk-11/include/jawt.h
 jdk-11/include/jdwpTransport.h
 jdk-11/include/jni.h
 jdk-11/include/jvmti.h
 jdk-11/include/jvmticmlr.h
 jdk-11/include/linux/jawt_md.h
 jdk-11/include/linux/jni_md.h
 jdk-11/jmods/java.base.jmod
 jdk-11/jmods/java.compiler.jmod
 jdk-11/jmods/java.datatransfer.jmod
 jdk-11/jmods/java.desktop.jmod
 jdk-11/jmods/java.instrument.jmod
 jdk-11/jmods/java.logging.jmod
 jdk-11/jmods/java.management.jmod
 jdk-11/jmods/java.management.rmi.jmod
 jdk-11/jmods/java.naming.jmod
 jdk-11/jmods/java.net.http.jmod
 jdk-11/jmods/java.prefs.jmod
 jdk-11/jmods/java.rmi.jmod
 jdk-11/jmods/java.scripting.jmod
 jdk-11/jmods/java.se.jmod
 jdk-11/jmods/java.security.jgss.jmod
 jdk-11/jmods/java.security.sasl.jmod
 jdk-11/jmods/java.smartcardio.jmod
 jdk-11/jmods/java.sql.jmod
 jdk-11/jmods/java.sql.rowset.jmod
 jdk-11/jmods/java.transaction.xa.jmod
 jdk-11/jmods/java.xml.crypto.jmod
 jdk-11/jmods/java.xml.jmod
 jdk-11/jmods/jdk.accessibility.jmod
 jdk-11/jmods/jdk.aot.jmod
 jdk-11/jmods/jdk.attach.jmod
 jdk-11/jmods/jdk.charsets.jmod
 jdk-11/jmods/jdk.compiler.jmod
 jdk-11/jmods/jdk.crypto.cryptoki.jmod
 jdk-11/jmods/jdk.crypto.ec.jmod
 jdk-11/jmods/jdk.dynalink.jmod
 jdk-11/jmods/jdk.editpad.jmod
 jdk-11/jmods/jdk.hotspot.agent.jmod
 jdk-11/jmods/jdk.httpserver.jmod
 jdk-11/jmods/jdk.internal.ed.jmod
 jdk-11/jmods/jdk.internal.jvmstat.jmod
 jdk-11/jmods/jdk.internal.le.jmod
 jdk-11/jmods/jdk.internal.opt.jmod
 jdk-11/jmods/jdk.internal.vm.ci.jmod
 jdk-11/jmods/jdk.internal.vm.compiler.jmod
 gzip: stdin: unexpected end of file
 tar: Unexpected EOF in archive
 tar: Unexpected EOF in archive
 tar: Error is not recoverable: exiting now

上記の2通りでできなかったので、UbuntuのCloud9環境を作り直してトライすることにした。

jdk11のインストール手順

まずはjavaのバージョン確認。環境作りたての時点だと1.8がインストールされている。

$ java -version
 openjdk version "1.8.0_222"
 OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
 OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

リポジトリを追加する。

$ sudo add-apt-repository ppa:openjdk-r/ppa
 More info: https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa
 Press [ENTER] to continue or Ctrl-c to cancel adding it.
 Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
 Hit:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease                                             
 Hit:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease                                     
 Hit:4 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease                                   
 Get:5 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu bionic InRelease [15.4 kB]                                         
 Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease
 Get:7 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu bionic/main amd64 Packages [7060 B]
 Get:8 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu bionic/main Translation-en [1380 B]
 Fetched 23.8 kB in 2s (13.8 kB/s)                   
 Reading package lists… Done

リポジトリを追加したので、ライブラリを更新する

$ sudo apt-get update
 Hit:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
 Hit:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease                                     
 Hit:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease                                   
 Hit:4 https://download.docker.com/linux/ubuntu bionic InRelease                                                        
 Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                      
 Hit:6 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu bionic InRelease
 Reading package lists… Done

インストールできるjdkを確認する

$ sudo apt-cache search openjdk-.+-jdk$
 openjdk-11-jdk - OpenJDK Development Kit (JDK)
 openjdk-8-jdk - OpenJDK Development Kit (JDK)
 openjdk-12-jdk - OpenJDK Development Kit (JDK)
 openjdk-13-jdk - OpenJDK Development Kit (JDK)

openjdk-11-jdkをインストールする

$ sudo apt-get install openjdk-11-jdk
 Reading package lists… Done
 Building dependency tree       
 Reading state information… Done
 The following additional packages will be installed:
   fonts-dejavu-extra libatk-wrapper-java libatk-wrapper-java-jni libice-dev libpthread-stubs0-dev libsm-dev libx11-dev
   libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-11-jdk-headless openjdk-11-jre
   openjdk-11-jre-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev
 Suggested packages:
   libice-doc libsm-doc libxcb-doc libxt-doc openjdk-11-demo openjdk-11-source visualvm libnss-mdns
   fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic
 The following NEW packages will be installed:
   fonts-dejavu-extra libatk-wrapper-java libatk-wrapper-java-jni libice-dev libpthread-stubs0-dev libsm-dev libx11-dev
   libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre
   openjdk-11-jre-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev
 0 upgraded, 20 newly installed, 0 to remove and 40 not upgraded.
 Need to get 236 MB of archives.
 After this operation, 398 MB of additional disk space will be used.
 Do you want to continue? [Y/n] y
 Get:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 fonts-dejavu-extra all 2.37-1 [1953 kB]
 Get:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libatk-wrapper-java all 0.33.3-20ubuntu0.1 [34.7 kB]
 Get:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libatk-wrapper-java-jni amd64 0.33.3-20ubuntu0.1 [28.3 kB]
 Get:4 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 xorg-sgml-doctools all 1:1.11-1 [12.9 kB]
 Get:5 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-dev all 2018.4-4 [251 kB]
 Get:6 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-core-dev all 2018.4-4 [2620 B]
 Get:7 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libice-dev amd64 2:1.0.9-2 [46.8 kB]
 Get:8 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libpthread-stubs0-dev amd64 0.3-4 [4068 B]
 Get:9 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libsm-dev amd64 2:1.2.2-1 [16.2 kB]
 Get:10 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libxau-dev amd64 1:1.0.8-1 [11.1 kB]
 Get:11 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libxdmcp-dev amd64 1:1.1.2-3 [25.1 kB]
 Get:12 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 xtrans-dev all 1.3.5-1 [70.5 kB]
 Get:13 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxcb1-dev amd64 1.13-2~ubuntu18.04 [80.0 kB]
 Get:14 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libx11-dev amd64 2:1.6.4-3ubuntu0.2 [640 kB]
 Get:15 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libx11-doc all 2:1.6.4-3ubuntu0.2 [2065 kB]
 Get:16 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libxt-dev amd64 1:1.1.5-1 [395 kB]
 Get:17 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 openjdk-11-jre-headless amd64 11.0.4+11-1ubuntu2~18.04.3 [37.4 MB]
 Get:18 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 openjdk-11-jre amd64 11.0.4+11-1ubuntu2~18.04.3 [34.4 kB]
 Get:19 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 openjdk-11-jdk-headless amd64 11.0.4+11-1ubuntu2~18.04.3 [191 MB]
 Get:20 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 openjdk-11-jdk amd64 11.0.4+11-1ubuntu2~18.04.3 [2173 kB]
 Fetched 236 MB in 11s (21.3 MB/s)                                                                                      
 Selecting previously unselected package fonts-dejavu-extra.
 (Reading database … 159112 files and directories currently installed.)
 Preparing to unpack …/00-fonts-dejavu-extra_2.37-1_all.deb …
 Unpacking fonts-dejavu-extra (2.37-1) …
 Selecting previously unselected package libatk-wrapper-java.
 Preparing to unpack …/01-libatk-wrapper-java_0.33.3-20ubuntu0.1_all.deb …
 Unpacking libatk-wrapper-java (0.33.3-20ubuntu0.1) …
 Selecting previously unselected package libatk-wrapper-java-jni:amd64.
 Preparing to unpack …/02-libatk-wrapper-java-jni_0.33.3-20ubuntu0.1_amd64.deb …
 Unpacking libatk-wrapper-java-jni:amd64 (0.33.3-20ubuntu0.1) …
 Selecting previously unselected package xorg-sgml-doctools.
 Preparing to unpack …/03-xorg-sgml-doctools_1%3a1.11-1_all.deb …
 Unpacking xorg-sgml-doctools (1:1.11-1) …
 Selecting previously unselected package x11proto-dev.
 Preparing to unpack …/04-x11proto-dev_2018.4-4_all.deb …
 Unpacking x11proto-dev (2018.4-4) …
 Selecting previously unselected package x11proto-core-dev.
 Preparing to unpack …/05-x11proto-core-dev_2018.4-4_all.deb …
 Unpacking x11proto-core-dev (2018.4-4) …
 Selecting previously unselected package libice-dev:amd64.
 Preparing to unpack …/06-libice-dev_2%3a1.0.9-2_amd64.deb …
 Unpacking libice-dev:amd64 (2:1.0.9-2) …
 Selecting previously unselected package libpthread-stubs0-dev:amd64.
 Preparing to unpack …/07-libpthread-stubs0-dev_0.3-4_amd64.deb …
 Unpacking libpthread-stubs0-dev:amd64 (0.3-4) …
 Selecting previously unselected package libsm-dev:amd64.
 Preparing to unpack …/08-libsm-dev_2%3a1.2.2-1_amd64.deb …
 Unpacking libsm-dev:amd64 (2:1.2.2-1) …
 Selecting previously unselected package libxau-dev:amd64.
 Preparing to unpack …/09-libxau-dev_1%3a1.0.8-1_amd64.deb …
 Unpacking libxau-dev:amd64 (1:1.0.8-1) …
 Selecting previously unselected package libxdmcp-dev:amd64.
 Preparing to unpack …/10-libxdmcp-dev_1%3a1.1.2-3_amd64.deb …
 Unpacking libxdmcp-dev:amd64 (1:1.1.2-3) …
 Selecting previously unselected package xtrans-dev.
 Preparing to unpack …/11-xtrans-dev_1.3.5-1_all.deb …
 Unpacking xtrans-dev (1.3.5-1) …
 Selecting previously unselected package libxcb1-dev:amd64.
 Preparing to unpack …/12-libxcb1-dev_1.13-2~ubuntu18.04_amd64.deb …
 Unpacking libxcb1-dev:amd64 (1.13-2~ubuntu18.04) …
 Selecting previously unselected package libx11-dev:amd64.
 Preparing to unpack …/13-libx11-dev_2%3a1.6.4-3ubuntu0.2_amd64.deb …
 Unpacking libx11-dev:amd64 (2:1.6.4-3ubuntu0.2) …
 Selecting previously unselected package libx11-doc.
 Preparing to unpack …/14-libx11-doc_2%3a1.6.4-3ubuntu0.2_all.deb …
 Unpacking libx11-doc (2:1.6.4-3ubuntu0.2) …
 Selecting previously unselected package libxt-dev:amd64.
 Preparing to unpack …/15-libxt-dev_1%3a1.1.5-1_amd64.deb …
 Unpacking libxt-dev:amd64 (1:1.1.5-1) …
 Selecting previously unselected package openjdk-11-jre-headless:amd64.
 Preparing to unpack …/16-openjdk-11-jre-headless_11.0.4+11-1ubuntu2~18.04.3_amd64.deb …
 Unpacking openjdk-11-jre-headless:amd64 (11.0.4+11-1ubuntu2~18.04.3) …
 Selecting previously unselected package openjdk-11-jre:amd64.
 Preparing to unpack …/17-openjdk-11-jre_11.0.4+11-1ubuntu2~18.04.3_amd64.deb …
 Unpacking openjdk-11-jre:amd64 (11.0.4+11-1ubuntu2~18.04.3) …
 Selecting previously unselected package openjdk-11-jdk-headless:amd64.
 Preparing to unpack …/18-openjdk-11-jdk-headless_11.0.4+11-1ubuntu2~18.04.3_amd64.deb …
 Unpacking openjdk-11-jdk-headless:amd64 (11.0.4+11-1ubuntu2~18.04.3) …
 Selecting previously unselected package openjdk-11-jdk:amd64.
 Preparing to unpack …/19-openjdk-11-jdk_11.0.4+11-1ubuntu2~18.04.3_amd64.deb …
 Unpacking openjdk-11-jdk:amd64 (11.0.4+11-1ubuntu2~18.04.3) …
 Setting up libpthread-stubs0-dev:amd64 (0.3-4) …
 Setting up xorg-sgml-doctools (1:1.11-1) …
 Setting up openjdk-11-jre-headless:amd64 (11.0.4+11-1ubuntu2~18.04.3) …
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/java to provide /usr/bin/java (java) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
 Setting up openjdk-11-jdk-headless:amd64 (11.0.4+11-1ubuntu2~18.04.3) …
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jar to provide /usr/bin/jar (jar) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/javac to provide /usr/bin/javac (javac) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/javap to provide /usr/bin/javap (javap) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jdeprscan to provide /usr/bin/jdeprscan (jdeprscan) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jimage to provide /usr/bin/jimage (jimage) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jlink to provide /usr/bin/jlink (jlink) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jmod to provide /usr/bin/jmod (jmod) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jps to provide /usr/bin/jps (jps) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jshell to provide /usr/bin/jshell (jshell) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jaotc to provide /usr/bin/jaotc (jaotc) in auto mode
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jhsdb to provide /usr/bin/jhsdb (jhsdb) in auto mode
 Setting up xtrans-dev (1.3.5-1) …
 Setting up libx11-doc (2:1.6.4-3ubuntu0.2) …
 Setting up fonts-dejavu-extra (2.37-1) …
 Setting up libatk-wrapper-java (0.33.3-20ubuntu0.1) …
 Setting up openjdk-11-jre:amd64 (11.0.4+11-1ubuntu2~18.04.3) …
 Setting up libatk-wrapper-java-jni:amd64 (0.33.3-20ubuntu0.1) …
 Setting up openjdk-11-jdk:amd64 (11.0.4+11-1ubuntu2~18.04.3) …
 update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
 Processing triggers for hicolor-icon-theme (0.17-2) …
 Processing triggers for fontconfig (2.12.6-0ubuntu2) …
 Processing triggers for mime-support (3.60ubuntu1) …
 Processing triggers for sgml-base (1.29) …
 Setting up x11proto-dev (2018.4-4) …
 Setting up libxdmcp-dev:amd64 (1:1.1.2-3) …
 Processing triggers for libc-bin (2.27-3ubuntu1) …
 Setting up libice-dev:amd64 (2:1.0.9-2) …
 Processing triggers for man-db (2.8.3-2ubuntu0.1) …
 Setting up libsm-dev:amd64 (2:1.2.2-1) …
 Setting up x11proto-core-dev (2018.4-4) …
 Setting up libxau-dev:amd64 (1:1.0.8-1) …
 Setting up libxcb1-dev:amd64 (1.13-2~ubuntu18.04) …
 Setting up libx11-dev:amd64 (2:1.6.4-3ubuntu0.2) …
 Setting up libxt-dev:amd64 (1:1.1.5-1) …

javaとjavacのバージョンを確認する。11以上であればOK。そうじゃないときはバージョンをこの次のコマンドでバージョンを変更する。

$ java -version
 openjdk version "11.0.4" 2019-07-16
 OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
 OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)
$ javac -version
 javac 11.0.4

javaとjavacでバージョンを変更する。選択肢から数字を選択するように聞かれるので、今回だと、java-11-openjdk-amd64の行を選択。Statusは違いがわからないのでauto modeの 0 を選択。

$ sudo update-alternatives --config java
 There are 2 choices for the alternative java (providing /usr/bin/java).
   Selection    Path                                            Priority   Status
 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
 1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
 2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode 
 Press  to keep the current choice[*], or type selection number: 0
$ sudo update-alternatives --config javac
 There are 2 choices for the alternative javac (providing /usr/bin/javac).
   Selection    Path                                          Priority   Status
 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/javac   1111      auto mode
 1            /usr/lib/jvm/java-11-openjdk-amd64/bin/javac   1111      manual mode
 2            /usr/lib/jvm/java-8-openjdk-amd64/bin/javac    1081      manual mode 
 Press  to keep the current choice[*], or type selection number: 0

参考

https://qiita.com/Rusty-Alucard/items/30b126692665954191ad


Comments

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です