Run sudo update-java-alternatives --list to list off all the Java installations on a machine by name and directory,and then run sudo update-java-alternatives --set [JDK/JRE name e.g. java-8-oracle] to choose which JRE/JDK to use. If you want to use different JDKs/JREs for each Java task,you can run update-alternatives to configure one java executable at a time; you can run sudo update-alternatives --config java[Tab] to see the Java commands that can be configured (java,javac,javah,javaws,etc). And then sudo update-alternatives --config [javac|java|javadoc|etc.] will associate that Java task/command to a particular JDK/JRE. You may also need to set JAVA_HOME for some applications: from this answer you can use export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") for JREs,or export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:jre/bin/java::") for JDKs. |
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。