Use Apt-get to install ORACLE-JDK on Ubuntu

Source: Internet
Author: User

  1. Installing default JRE/JDK

    sudo apt-get update
    sudo apt-get install Default-jre
    sudo apt-get install DEFAULT-JDK

  2. Installing Oracle JDK

    sudo apt-get install python-software-properties
    sudo add-apt-repository Ppa:webupd8team/java
    sudo apt-get update

    Oracle JDK 6 (older version)
    sudo apt-get install Oracle-java6-installer
    Oracle JDK 7 (newer stable version)
    sudo apt-get install Oracle-java7-installer
    Oracle JDK 8 (latest preview version)
    sudo apt-get install Oracle-java8-installer

  3. Managing Java

    sudo update-alternatives--config Java has 2 candidates that can be used to replace Java (providing/usr/bin/java).

    Select Path Priority state

    * 0/usr/lib/jvm/java-7-oracle/jre/bin/java 1072 Auto mode
    1/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 Manual Mode
    2/usr/lib/jvm/java-7-oracle/jre/bin/java 1072 Manual Mode
    To maintain the current value [*], press ENTER, or type the number you selected:
    (I pressed the carriage return, did not change)
    sudo update-alternatives--config javac
    Ibid.

  4. Setting the "java_home" environment variable This command allows you to see the JAVA installation path:

    sudo update-alternatives--config Java determines the path according to the option set, I am using the default first, so path is:

    "/usr/lib/jvm/java-7-oracle"
    sudo vim/etc/environment
    At the end of the file add:

    Java_home= "/usr/lib/jvm/java-7-oracle"

Save exit (: Wq), enter in Terminal:

source /etc/environment

Then enter:
Echo $JAVA _home
If the output is the same as our setup, it means that we have successfully installed it, and then you can look at the Java version:

java -version

Use Apt-get to install ORACLE-JDK on Ubuntu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.