Ubuntu16.04 default Java set to Oracle in the jdk!

Source: Internet
Author: User

There is already a openjdk in the system, the default JDK is it, not the Oracle JDK, do the following to set the Oracle JDK as the default!

First, let's say we've installed and configured the Oracle JDK, but the "java-version" display in the shell is openjdk!

Execute the following command in turn:

sudo update-alternatives--install/usr/bin/java java/usr/jdk1.8.0_121/bin/java  sudo update-alternatives-- Install/usr/bin/javac Javac/usr/jdk1.8.0_121/bin/javac 300  

Note: The top two commands above, "/usr/jdk1.8.0_121" This is my Oracle JDK directory, if you are not this directory, you have to change to your correct directory!

After executing update-alternatives--config Java, the system lists all the JDK, we select the Oracle JDK index number, then the carriage return is possible!

Ubuntu16.04 default Java set to Oracle in the jdk!

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.