美文网首页
ubuntu debian 一键安装java 11

ubuntu debian 一键安装java 11

作者: baymin_ | 来源:发表于2019-01-11 21:23 被阅读38次

    Install Oracle Java 11 (JDK 11) in Ubuntu, Linux Mint or Debian from PPA

    To add the LinuxUprising Java PPA repository to your software sources and install Oracle Java 11 in Ubuntu or Linux Mint (64bit only) you can use the commands below:

    sudo add-apt-repository ppa:linuxuprising/java
    sudo apt update
    sudo apt install oracle-java11-installer
    

    In Debian (64bit only) you can add the repository and install Oracle Java 11 using these commands:

    su -
    echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | tee /etc/apt/sources.list.d/linuxuprising-java.list
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A
    apt-get update
    apt-get install oracle-java11-installer
    exit
    

    The oracle-java11-installer package has a Recommends field for the oracle-java11-set-default package, which sets Oracle Java 11 as default (including setting the JAVA_HOME environment variable, which requires a session restart). Such recommended packages are installed automatically on Ubuntu, but are not on other Debian-based Linux distributions.

    So to make Oracle Java 11 default, install the oracle-java11-set-default package:

    sudo apt install oracle-java11-set-default
    

    If you want to have Oracle Java 11 installed but not set it as the default Java, make sure the oracle-java11-set-default package is not installed / remove it:

    sudo apt remove oracle-java11-set-default
    

    You can check to see if Oracle Java 11 is set as default by checking your current Java version using the following command:

    java -version
    

    If Oracle Java 11 is default, you should see an output similar to the following:

    java version "11" 2018-09-25
    Java(TM) SE Runtime Environment 18.9 (build 11+28)
    Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
    

    You can try it for javac as well:

    javac -version
    

    Which should return an output similar to the one below:

    javac 11
    

    相关文章

      网友评论

          本文标题:ubuntu debian 一键安装java 11

          本文链接:https://www.haomeiwen.com/subject/ruufdqtx.html