Linux installs JDK using ppa/source mode

Source: Internet
Author: User

1. Add PPA
sudo add-apt-repository ppa:webupd8team/javasudo apt-get update
2. Installing Oracle-java-installer

Jdk7

sudo apt-get install Oracle-java7-installer

Jdk8

sudo apt-get install Oracle-java8-installer

The installer will prompt you to agree to Oracle's terms of service, select OK

Then select Yes to

If you're lazy, don't want to manually click on it yourself. You can also add the following command, by default, agree to the terms:

JDK7 Default Selection Terms

echo oracle-java7-installer Shared/accepted-oracle-license-v1-1 Select True | Sudo/usr/bin/debconf-set-selections

JDK8 Default Selection Terms

echo oracle-java8-installer Shared/accepted-oracle-license-v1-1 Select True | Sudo/usr/bin/debconf-set-selections

Next will be waiting (depending on the speed of the individual)

If you cause installer to download slowly due to firewalls or other reasons, you can interrupt the operation. Then download the tar.gz package for the corresponding JDK, and put it in:

/var/cache/oracle-jdk7-installer (JDK7)

/var/cache/oracle-jdk8-installer (JDK8)

Below, and then install the installer once. Installer will use the TAR.GZ package you downloaded by default

3. Set the system default JDK

JDk7

sudo update-java-alternatives-s java-7-oracle

JDK8

sudo update-java-alternatives-s java-8-oracle

If the JDK7 is installed and the JDK8 is installed, to switch between the two, you can:

JDK8 Switch to Jdk7

sudo update-java-alternatives-s java-7-oracle

JDK7 Switch to Jdk8

sudo update-java-alternatives-s java-8-oracle

4. Test whether the JDK was installed successfully:

Java-versionjavac-version

Linux installs JDK using ppa/source mode

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.