我已经安装了 openjdk-8(来自官方仓库)apt-get install openjdk-8-jre-headless openjdk-8-jre openjdk-8-jdk
并更新了替代方案update-alternatives --config java
现在
$ update-alternatives --get-selections|grep java
appletviewer auto /usr/lib/jvm/java-7-openjdk-amd64/bin/appletviewer
extcheck auto /usr/lib/jvm/java-7-openjdk-amd64/bin/extcheck
idlj auto /usr/lib/jvm/java-7-openjdk-amd64/bin/idlj
itweb-settings auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/itweb-settings
jar auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jar
jarsigner auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jarsigner
java manual /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
java2groovy auto /usr/share/groovy/bin/java2groovy
javac auto /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
javadoc auto /usr/lib/jvm/java-7-openjdk-amd64/bin/javadoc
javah auto /usr/lib/jvm/java-7-openjdk-amd64/bin/javah
javap auto /usr/lib/jvm/java-7-openjdk-amd64/bin/javap
javaws auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws
jcmd auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jcmd
jconsole auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jconsole
jdb auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jdb
jdeps auto /usr/lib/jvm/java-8-openjdk-amd64/bin/jdeps
jexec auto /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jexec
jhat auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jhat
jinfo auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jinfo
jjs auto /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jjs
jmap auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jmap
jps auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jps
jrunscript auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jrunscript
jsadebugd auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jsadebugd
jstack auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jstack
jstat auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jstat
jstatd auto /usr/lib/jvm/java-7-openjdk-amd64/bin/jstatd
keytool auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
mozilla-javaplugin.so auto /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
native2ascii auto /usr/lib/jvm/java-7-openjdk-amd64/bin/native2ascii
orbd auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/orbd
pack200 auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/pack200
policytool auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/policytool
rmic auto /usr/lib/jvm/java-7-openjdk-amd64/bin/rmic
rmid auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/rmid
rmiregistry auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/rmiregistry
schemagen auto /usr/lib/jvm/java-7-openjdk-amd64/bin/schemagen
serialver auto /usr/lib/jvm/java-7-openjdk-amd64/bin/serialver
servertool auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/servertool
tnameserv auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/tnameserv
unpack200 auto /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/unpack200
wsgen auto /usr/lib/jvm/java-7-openjdk-amd64/bin/wsgen
wsimport auto /usr/lib/jvm/java-7-openjdk-amd64/bin/wsimport
xjc auto /usr/lib/jvm/java-7-openjdk-amd64/bin/xjc
因此许多工具仍然使用 Java 7。如何使 Java 8 成为实际/默认版本?是否可以重新安装 Java 8,以便自动将其设置为默认版本,而不是将每个替代方案更改为 Java 8?
此外,当我尝试删除 java 7 时,apt-get 会尝试删除很多软件包:
# apt-get purge openjdk-7-jreheadless openjdk-7-jre openjdk-7-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
ant ant-optional antlr aspectj bnd bsh checkstyle fop ivy java-wrappers junit junit4 libaether-java libantlr-java libaopalliance-java libapache-pom-java
libasm3-java libasm4-java libaspectj-java libasync-http-client-java libatinject-jsr330-api-java libavalon-framework-java libbatik-java libbcel-java
libbcpg-java libbcprov-java libbindex-java libbsf-java libbsh-java libcdi-api-java libcglib-java libclassworlds-java libcommons-beanutils-java
libcommons-cli-java libcommons-codec-java libcommons-collections3-java libcommons-configuration-java libcommons-dbcp-java libcommons-digester-java
libcommons-httpclient-java libcommons-io-java libcommons-jexl2-java libcommons-jxpath-java libcommons-lang-java libcommons-logging-java libcommons-net2-java
libcommons-parent-java libcommons-pool-java libcommons-vfs-java libconstantine-java libdom4j-java libdoxia-java libeasymock-java libecj-java libfop-java
libganymed-ssh2-java libgeronimo-interceptor-3.0-spec-java libgeronimo-jpa-2.0-spec-java libgeronimo-jta-1.1-spec-java libgeronimo-osgi-support-java
libgnuinet-java libgnujaf-java libgnumail-java libgoogle-gson-java libguava-java libguice-java libhamcrest-java libhawtjni-runtime-java libhttpclient-java
libhttpcore-java libitext1-java libjackrabbit-java libjaffl-java libjansi-java libjansi-native-java libjarjar-java libjatl-java libjaxen-java libjaxp1.3-java
libjcifs-java libjcip-annotations-java libjcommander-java libjdom1-java libjetty-extra libjetty-extra-java libjetty-java libjffi-java libjffi-jni libjline-java
libjna-java libjnr-posix-java libjnr-x86asm-java libjsch-agent-proxy-java libjsch-java libjsoup-java libjsr305-java libkryo-java liblog4j1.2-java
liblogback-java libmaven-ant-tasks-java libmaven-parent-java libmaven-scm-java libmaven2-core-java libminlog-java libmockobjects-java libmodello-java
libmx4j-java libnative-platform-java libnative-platform-jni libnekohtml-java libnetbeans-cvsclient-java libnetty-java libobjenesis-java libosgi-compendium-java
libosgi-core-java libosgi-foundation-ee-java libplexus-ant-factory-java libplexus-archiver-java libplexus-bsh-factory-java libplexus-build-api-java
libplexus-cipher-java libplexus-classworlds-java libplexus-classworlds2-java libplexus-cli-java libplexus-container-default-java libplexus-containers-java
libplexus-containers1.5-java libplexus-i18n-java libplexus-interactivity-api-java libplexus-interpolation-java libplexus-io-java libplexus-sec-dispatcher-java
libplexus-utils-java libplexus-utils2-java libpolyglot-maven-java libqdox-java libreflectasm-java libregexp-java librhino-java libsaxon-java libservlet2.5-java
libservlet3.0-java libsisu-guice-java libsisu-ioc-java libslf4j-java libtomcat7-java libwagon-java libwagon2-java libxalan2-java libxbean-java libxerces2-java
libxml-commons-external-java libxml-commons-resolver1.1-java libxmlgraphics-commons-java libxom-java libxpp2-java libxpp3-java libxstream-java
libyaml-snake-java maven rhino testng
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
icedtea-6-jre-cacao icedtea-6-jre-jamvm openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib ttf-dejavu-extra
Suggested packages:
sun-java6-fonts fonts-ipafont-gothic fonts-ipafont-mincho fonts-indic
The following packages will be REMOVED:
default-jre-headless* gradle* groovy* icedtea-7-jre-jamvm* icedtea-7-plugin* icedtea-netx* icedtea-plugin* libcodenarc-groovy-java* libgmetrics-groovy-java*
libgradle-core-java* libgradle-plugins-java* openjdk-7-jdk* openjdk-7-jre* openjdk-7-jre-headless*
The following NEW packages will be installed:
icedtea-6-jre-cacao icedtea-6-jre-jamvm openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib ttf-dejavu-extra
0 upgraded, 6 newly installed, 14 to remove and 0 not upgraded.
Need to get 38.0 MB of archives.
After this operation, 49.1 MB disk space will be freed.
Do you want to continue? [Y/n]
如何避免这种情况?它想要安装Java 6? 如何避免这种情况?