openjdk 9を指すようにDebian 9の代替案を変更することはできません。

openjdk 9を指すようにDebian 9の代替案を変更することはできません。

私はDebian 9にopenjdk 9をインストールしようとしましたが、すべてがそのインストールを指すようにしました。しかし、何かがオフになっていて、java端末の基本コマンドが指す場所を更新したくありません。

簡単な方法でopenjdk9をインストールしました。sudo apt-get install openjdk-9-jre openjdk-9-jdk

私が実行したら、readlink $(which java)以下を指します。/etc/alternatives/java

私が実行したら、readklink /etc/alternatives/java以下を指します。/usr/lib/jvm/java-9-openjdk-amd64/bin/java

しかし、最も奇妙なことは、一度実行すると、端末で実行したときに得られる結果が正確に何であるかを指すreadlink -f $(which java)ことです。/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/javajava -version

openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

シンボリックdefault-javaリンクはopenjdk 8も指します。

しかし、javac -version端末では正しく見えます。 javac 9.0.1

update-alternativesjava次のようによく似合うようですjavac:

$ 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-9-openjdk-amd64/bin/java       1091      auto mode
  1    /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1069      manual mode
* 2   /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode



$ 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-9-openjdk-amd64/bin/javac   1091      auto mode
  1       /usr/lib/jvm/java-8-openjdk-amd64/bin/javac   1069      manual mode
* 2       /usr/lib/jvm/java-9-openjdk-amd64/bin/javac   1091      manual mode

javaコマンドがシステムの残りの部分と一致することができない理由を知っている人はいますか?それとも、次に何を試すかについてのアイデアがありますか?

とても感謝しています。

スクリプトの編集と追加

    resu@laptop/usr/lib/jvm
$ ls -l
total 12
lrwxrwxrwx 1 root root   24 Jan  6  2017 default-java -> java-1.8.0-openjdk-amd64
drwxr-xr-x 4 root root 4096 Dec 16 16:47 java-1.5.0-gcj-6-amd64
lrwxrwxrwx 1 root root   20 Oct 25  2016 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64
lrwxrwxrwx 1 root root   20 Oct 26 19:44 java-1.9.0-openjdk-amd64 -> java-9-openjdk-amd64
drwxr-xr-x 7 root root 4096 Nov 26 01:18 java-8-openjdk-amd64
drwxr-xr-x 9 root root 4096 Dec 10 20:26 java-9-openjdk-amd64
lrwxrwxrwx 1 root root   34 Dec 31 20:09 java-latest -> /usr/lib/jvm/java-9-openjdk-amd64/

resu@laptop/usr/lib/jvm
$ cd /etc/alternatives/

resu@laptop/etc/alternatives
$ ls -l | grep java
lrwxrwxrwx 1 root root  50 Dec 31 20:06 appletviewer -> /usr/lib/jvm/java-9-openjdk-amd64/bin/appletviewer
lrwxrwxrwx 1 root root  60 Dec 31 20:06 appletviewer.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/appletviewer.1.gz
lrwxrwxrwx 1 root root  46 Jan 21  2017 extcheck -> /usr/lib/jvm/java-8-openjdk-amd64/bin/extcheck
lrwxrwxrwx 1 root root  56 Jan 21  2017 extcheck.1.gz -> /usr/lib/jvm/java-8-openjdk-amd64/man/man1/extcheck.1.gz
lrwxrwxrwx 1 root root  42 Dec 10 20:26 idlj -> /usr/lib/jvm/java-9-openjdk-amd64/bin/idlj
lrwxrwxrwx 1 root root  52 Dec 10 20:26 idlj.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/idlj.1.gz
lrwxrwxrwx 1 root root  56 Oct  8 17:17 itweb-settings -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/itweb-settings
lrwxrwxrwx 1 root root  66 Oct  8 17:17 itweb-settings.1.gz -> /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/itweb-settings.1.gz
lrwxrwxrwx 1 root root  43 Dec 10 20:26 jaotc -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jaotc
lrwxrwxrwx 1 root root  41 Dec 10 20:26 jar -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jar
lrwxrwxrwx 1 root root  51 Dec 10 20:26 jar.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jar.1.gz
lrwxrwxrwx 1 root root  47 Dec 10 20:26 jarsigner -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jarsigner
lrwxrwxrwx 1 root root  57 Dec 10 20:26 jarsigner.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jarsigner.1.gz
lrwxrwxrwx 1 root root  42 Dec 31 20:06 java -> /usr/lib/jvm/java-9-openjdk-amd64/bin/java
lrwxrwxrwx 1 root root  52 Dec 31 20:06 java.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/java.1.gz
lrwxrwxrwx 1 root root  43 Dec 31 20:06 javac -> /usr/lib/jvm/java-9-openjdk-amd64/bin/javac
lrwxrwxrwx 1 root root  53 Dec 31 20:06 javac.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/javac.1.gz
lrwxrwxrwx 1 root root  45 Dec 10 20:26 javadoc -> /usr/lib/jvm/java-9-openjdk-amd64/bin/javadoc
lrwxrwxrwx 1 root root  55 Dec 10 20:26 javadoc.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/javadoc.1.gz
lrwxrwxrwx 1 root root  43 Dec 10 20:26 javah -> /usr/lib/jvm/java-9-openjdk-amd64/bin/javah
lrwxrwxrwx 1 root root  53 Dec 10 20:26 javah.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/javah.1.gz
lrwxrwxrwx 1 root root  43 Dec 10 20:26 javap -> /usr/lib/jvm/java-9-openjdk-amd64/bin/javap
lrwxrwxrwx 1 root root  53 Dec 10 20:26 javap.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/javap.1.gz
lrwxrwxrwx 1 root root  48 Oct  8 17:17 javaws -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/javaws
lrwxrwxrwx 1 root root  58 Oct  8 17:17 javaws.1.gz -> /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/javaws.1.gz
lrwxrwxrwx 1 root root  42 Dec 10 20:26 jcmd -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jcmd
lrwxrwxrwx 1 root root  52 Dec 10 20:26 jcmd.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jcmd.1.gz
lrwxrwxrwx 1 root root  46 Dec 31 20:06 jconsole -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jconsole
lrwxrwxrwx 1 root root  56 Dec 31 20:06 jconsole.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jconsole.1.gz
lrwxrwxrwx 1 root root  41 Dec 10 20:26 jdb -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jdb
lrwxrwxrwx 1 root root  51 Dec 10 20:26 jdb.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jdb.1.gz
lrwxrwxrwx 1 root root  47 Dec 10 20:26 jdeprscan -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jdeprscan
lrwxrwxrwx 1 root root  43 Dec 10 20:26 jdeps -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jdeps
lrwxrwxrwx 1 root root  53 Dec 10 20:26 jdeps.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jdeps.1.gz
lrwxrwxrwx 1 root root  43 Dec 31 20:06 jexec -> /usr/lib/jvm/java-9-openjdk-amd64/lib/jexec
lrwxrwxrwx 1 root root  48 Dec 31 20:06 jexec-binfmt -> /usr/lib/jvm/java-9-openjdk-amd64/lib/jar.binfmt
lrwxrwxrwx 1 root root  42 Jan 21  2017 jhat -> /usr/lib/jvm/java-8-openjdk-amd64/bin/jhat
lrwxrwxrwx 1 root root  52 Jan 21  2017 jhat.1.gz -> /usr/lib/jvm/java-8-openjdk-amd64/man/man1/jhat.1.gz
lrwxrwxrwx 1 root root  43 Dec 10 20:26 jhsdb -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jhsdb
lrwxrwxrwx 1 root root  44 Dec 10 20:26 jimage -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jimage
lrwxrwxrwx 1 root root  43 Dec 10 20:26 jinfo -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jinfo
lrwxrwxrwx 1 root root  53 Dec 10 20:26 jinfo.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jinfo.1.gz
lrwxrwxrwx 1 root root  41 Dec 31 20:06 jjs -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jjs
lrwxrwxrwx 1 root root  51 Dec 31 20:06 jjs.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jjs.1.gz
lrwxrwxrwx 1 root root  43 Dec 10 20:26 jlink -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jlink
lrwxrwxrwx 1 root root  42 Dec 10 20:26 jmap -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jmap
lrwxrwxrwx 1 root root  52 Dec 10 20:26 jmap.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jmap.1.gz
lrwxrwxrwx 1 root root  42 Dec 10 20:26 jmod -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jmod
lrwxrwxrwx 1 root root  41 Dec 10 20:26 jps -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jps
lrwxrwxrwx 1 root root  51 Dec 10 20:26 jps.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jps.1.gz
lrwxrwxrwx 1 root root  48 Dec 10 20:26 jrunscript -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jrunscript
lrwxrwxrwx 1 root root  58 Dec 10 20:26 jrunscript.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jrunscript.1.gz
lrwxrwxrwx 1 root root  47 Jan 21  2017 jsadebugd -> /usr/lib/jvm/java-8-openjdk-amd64/bin/jsadebugd
lrwxrwxrwx 1 root root  57 Jan 21  2017 jsadebugd.1.gz -> /usr/lib/jvm/java-8-openjdk-amd64/man/man1/jsadebugd.1.gz
lrwxrwxrwx 1 root root  44 Dec 10 20:26 jshell -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jshell
lrwxrwxrwx 1 root root  44 Dec 10 20:26 jstack -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jstack
lrwxrwxrwx 1 root root  54 Dec 10 20:26 jstack.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jstack.1.gz
lrwxrwxrwx 1 root root  43 Dec 10 20:26 jstat -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jstat
lrwxrwxrwx 1 root root  53 Dec 10 20:26 jstat.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jstat.1.gz
lrwxrwxrwx 1 root root  44 Dec 10 20:26 jstatd -> /usr/lib/jvm/java-9-openjdk-amd64/bin/jstatd
lrwxrwxrwx 1 root root  54 Dec 10 20:26 jstatd.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/jstatd.1.gz
lrwxrwxrwx 1 root root  45 Dec 31 20:06 keytool -> /usr/lib/jvm/java-9-openjdk-amd64/bin/keytool
lrwxrwxrwx 1 root root  55 Dec 31 20:06 keytool.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/keytool.1.gz
lrwxrwxrwx 1 root root  64 Oct  8 17:18 mozilla-javaplugin.so -> /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
lrwxrwxrwx 1 root root  50 Jan 21  2017 native2ascii -> /usr/lib/jvm/java-8-openjdk-amd64/bin/native2ascii
lrwxrwxrwx 1 root root  60 Jan 21  2017 native2ascii.1.gz -> /usr/lib/jvm/java-8-openjdk-amd64/man/man1/native2ascii.1.gz
lrwxrwxrwx 1 root root  42 Dec 31 20:06 orbd -> /usr/lib/jvm/java-9-openjdk-amd64/bin/orbd
lrwxrwxrwx 1 root root  52 Dec 31 20:06 orbd.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/orbd.1.gz
lrwxrwxrwx 1 root root  45 Dec 31 20:06 pack200 -> /usr/lib/jvm/java-9-openjdk-amd64/bin/pack200
lrwxrwxrwx 1 root root  55 Dec 31 20:06 pack200.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/pack200.1.gz
lrwxrwxrwx 1 root root  54 Oct  8 17:17 policyeditor -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/policyeditor
lrwxrwxrwx 1 root root  64 Oct  8 17:17 policyeditor.1.gz -> /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/policyeditor.1.gz
lrwxrwxrwx 1 root root  48 Dec 31 20:06 policytool -> /usr/lib/jvm/java-9-openjdk-amd64/bin/policytool
lrwxrwxrwx 1 root root  58 Dec 31 20:06 policytool.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/policytool.1.gz
lrwxrwxrwx 1 root root  42 Dec 10 20:26 rmic -> /usr/lib/jvm/java-9-openjdk-amd64/bin/rmic
lrwxrwxrwx 1 root root  52 Dec 10 20:26 rmic.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/rmic.1.gz
lrwxrwxrwx 1 root root  42 Dec 31 20:06 rmid -> /usr/lib/jvm/java-9-openjdk-amd64/bin/rmid
lrwxrwxrwx 1 root root  52 Dec 31 20:06 rmid.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/rmid.1.gz
lrwxrwxrwx 1 root root  49 Dec 31 20:06 rmiregistry -> /usr/lib/jvm/java-9-openjdk-amd64/bin/rmiregistry
lrwxrwxrwx 1 root root  59 Dec 31 20:06 rmiregistry.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/rmiregistry.1.gz
lrwxrwxrwx 1 root root  47 Dec 10 20:26 schemagen -> /usr/lib/jvm/java-9-openjdk-amd64/bin/schemagen
lrwxrwxrwx 1 root root  57 Dec 10 20:26 schemagen.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/schemagen.1.gz
lrwxrwxrwx 1 root root  47 Dec 10 20:26 serialver -> /usr/lib/jvm/java-9-openjdk-amd64/bin/serialver
lrwxrwxrwx 1 root root  57 Dec 10 20:26 serialver.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/serialver.1.gz
lrwxrwxrwx 1 root root  48 Dec 31 20:06 servertool -> /usr/lib/jvm/java-9-openjdk-amd64/bin/servertool
lrwxrwxrwx 1 root root  58 Dec 31 20:06 servertool.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/servertool.1.gz
lrwxrwxrwx 1 root root  47 Dec 31 20:06 tnameserv -> /usr/lib/jvm/java-9-openjdk-amd64/bin/tnameserv
lrwxrwxrwx 1 root root  57 Dec 31 20:06 tnameserv.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/tnameserv.1.gz
lrwxrwxrwx 1 root root  47 Dec 31 20:06 unpack200 -> /usr/lib/jvm/java-9-openjdk-amd64/bin/unpack200
lrwxrwxrwx 1 root root  57 Dec 31 20:06 unpack200.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/unpack200.1.gz
lrwxrwxrwx 1 root root  43 Dec 10 20:26 wsgen -> /usr/lib/jvm/java-9-openjdk-amd64/bin/wsgen
lrwxrwxrwx 1 root root  53 Dec 10 20:26 wsgen.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/wsgen.1.gz
lrwxrwxrwx 1 root root  46 Dec 10 20:26 wsimport -> /usr/lib/jvm/java-9-openjdk-amd64/bin/wsimport
lrwxrwxrwx 1 root root  56 Dec 10 20:26 wsimport.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/wsimport.1.gz
lrwxrwxrwx 1 root root  41 Dec 10 20:26 xjc -> /usr/lib/jvm/java-9-openjdk-amd64/bin/xjc
lrwxrwxrwx 1 root root  51 Dec 10 20:26 xjc.1.gz -> /usr/lib/jvm/java-9-openjdk-amd64/man/man1/xjc.1.gz

resu@laptop/etc/alternatives
$ which java
/usr/bin/java

resu@laptop/etc/alternatives
$ type java
java is hashed (/usr/bin/java)

resu@laptop/etc/alternatives
$ readlink $(which java)
/etc/alternatives/java

resu@laptop/etc/alternatives
$ readlink -f $(which java)
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

resu@laptop/etc/alternatives
$ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

resu@laptop/etc/alternatives
$ javac -version
javac 9.0.1

resu@laptop/etc/alternatives
$ 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-9-openjdk-amd64/bin/java       1091      auto mode
  1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1069      manual mode
* 2            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode

Press <enter> to keep the current choice[*], or type selection number: ^C

resu@laptop/etc/alternatives
$ 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-9-openjdk-amd64/bin/javac   1091      auto mode
  1            /usr/lib/jvm/java-8-openjdk-amd64/bin/javac   1069      manual mode
* 2            /usr/lib/jvm/java-9-openjdk-amd64/bin/javac   1091      manual mode

ベストアンサー1

おすすめ記事