如何在 Debian 中将-java-alternatives 成功更新为 Oracle 的?

如何在 Debian 中将-java-alternatives 成功更新为 Oracle 的?

该命令update-java-alternatives -s jre-8-oracle-x64是完全有效的(在文档中也可以找到这里)但我收到错误。该包也可以在 Java 包列表中看到

root@masi:/home/masi# update-java-alternatives -l
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
jre-8-oracle-x64 317 /usr/lib/jvm/jre-8-oracle-x64

我做但无法得到jre-8-oracle-x64在我的系统中工作没有错误

# https://wiki.debian.org/JavaPackage
# http://unix.stackexchange.com/a/310787/16920
root@masi:/home/masi/Downloads# update-java-alternatives -s java-6-sun
update-java-alternatives: directory does not exist: /usr/lib/jvm/java-6-sun

root@masi:/home/masi/Downloads# ls /usr/lib/jvm/
default-java/                    java-7-openjdk-amd64/
java-1.7.0-openjdk-amd64/        jre-8-oracle-x64/
.java-1.7.0-openjdk-amd64.jinfo  .jre-8-oracle-x64.jinfo

root@masi:/home/masi/Downloads# update-java-alternatives -s jre-8-oracle-x64
update-alternatives: error: no alternatives for appletviewer
update-alternatives: error: no alternatives for extcheck
update-alternatives: error: no alternatives for idlj
update-alternatives: error: no alternatives for jar
update-alternatives: error: no alternatives for jarsigner
update-alternatives: error: no alternatives for javac
update-alternatives: error: no alternatives for javadoc
update-alternatives: error: no alternatives for javah
update-alternatives: error: no alternatives for javap
update-alternatives: error: no alternatives for jcmd
update-alternatives: error: no alternatives for jconsole
update-alternatives: error: no alternatives for jdb
update-alternatives: error: no alternatives for jhat
update-alternatives: error: no alternatives for jinfo
update-alternatives: error: no alternatives for jmap
update-alternatives: error: no alternatives for jps
update-alternatives: error: no alternatives for jrunscript
update-alternatives: error: no alternatives for jsadebugd
update-alternatives: error: no alternatives for jstack
update-alternatives: error: no alternatives for jstat
update-alternatives: error: no alternatives for jstatd
update-alternatives: error: no alternatives for native2ascii
update-alternatives: error: no alternatives for rmic
update-alternatives: error: no alternatives for schemagen
update-alternatives: error: no alternatives for serialver
update-alternatives: error: no alternatives for wsgen
update-alternatives: error: no alternatives for wsimport
update-alternatives: error: no alternatives for xjc

使用自动模式没有意义;也许,我应该先删除系统中的一些软件包

root@masi:/home/masi/Downloads# update-alternatives --auto java
update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode

操作系统:Debian 8.5
Linux 内核:向后移植 4.6
硬件:Asus Zenbook UX303UA
Java:JRE 8 版本 102 Oracle x64

答案1

这些错误是无害的,因为您使用的是 JRE;缺少的命令仅由 JDK 提供。运行后update-java-alternatives -s jre-8-oracle-x64java -version将确认您默认使用的是 Oracle JRE:

$ java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

相关内容