Install Oracle JDK on Ubuntu

Source: Internet
Author: User

1 using the source installation

Use the following command to install, just some time, it will download a lot of files, and you want to make sure that your network environment is good:

sudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get install oracle-java8-installersudo apt-get install oracle-java8-set-default

If you want to install Java 8(i.e Java 1.8) it, replace it in the command above java7 java8 .

2 Installing through the bin package

You can also install the common Bin package on Linux, download the official bin package, install the decompression under the terminal, and then modify the environment variable to point to the JDK

Select a different version as needed to download the bin package

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Unzip the downloaded jdk-8u101-linux-x64.tar.gz file.

Use the following command to extract:

sudo tar zxvf ./jdk-8u101-linux-x64.tar.gz

To facilitate management, the extracted files can be moved to another folder, the author moved the file to the /usr/java/jdk1.8.0_101 directory.

To facilitate the next set of environment variables, change the folder to a shorter name-jdk1.8

3 Setting environment variables

Edit. bashrc file

JAVA_HOME=/usr/java/jdk1.8.0_101JRE_HOME=$JAVA_HOME/jreJAVA_BIN=$JAVA_HOME/binCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libPATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binexport JAVA_HOME JRE_HOME PATH CLASSPATH

If you installed using the source method, the default installation path is in /usr/lib/jvm/java-8-oracle , and the corresponding Java_home is configured

JAVA_HOME=/usr/lib/jvm/java-8-oracle

In order for the changes to take effect immediately, execute the following command at the terminal:

source ~/.bashrc

4 Verification

With the above steps, the JDK is installed.

Enter the following command java -version to verify that


Install Oracle JDK on Ubuntu

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.