"Linux" installs Oracle Jdk6 in Ubuntu using Apt-get

Source: Internet
Author: User

Installing JDK6 on Ubuntu 12.04 Lts is not complicated by itself, but the newer version of Ubuntu is not supported directly through the Apt-get installation. Therefore, the installation package needs to be downloaded from the official Oracle website.

Download the JDK from Oracle website here, note that you choose the JDK version you need according to the number of bits and types of your system, if you download *.bin, this is a self-extracting file, you can use the SH *bin command to extract the file, then get the JDK file, then set the environment variable , it's done.

This way, first you have to download outside the system, because before the download, you need to log in, so using the Wget method download becomes not so easy, and then need to copy to the Ubuntu system, and then the installation is much simpler. However, this method is not advisable if the Linux Terminal command is installed only. Naturally, we thought of Ubuntu/debian's peculiar apt-get command.

Since the new version of Ubuntu does not support the installation of the Oracle version of the JDK directly through Apt-get, he has a openjdk, but it is recommended to install Oracle JDK if you are using it for development and not just for an environment. So, we do this:

First add the Oracle JDK Source:

1 apt-get install python-software-Properties2 add-apt-repository Ppa:webupd8team/java 3 apt-get Update

If the display python-software-properties is not found, you can update the source first:

1 echo "Deb Http://archive.ubuntu.com/ubuntu precise main Universe" >/etc/apt/sources.list2 Apt-get Update

And then download it again.

The final installation is:

RUN Apt-get install-y Oracle-java6-installer

If this problem occurs:

You can solve this problem:

Modify the/etc/lsb-release file to:

distrib_id=ubuntudistrib_release=12.04distrib_codename=precisedistrib_description= " Ubuntu 12.04 LTS "

And then proceed with the installation.

During the installation process, you will enter the interactive interface, perform license verification, and select Yes twice to install.

Finally, configure the environment variables to add in the file/etc/profile:

Export  path=/home/zl/jdk1.6.0_45/bin: $PATHexport  java_home=/home/zl/jdk1.6.0_45

Then you can view the Java version information through Java-version, and if there is no error, the installation is successful!

"Linux" installs Oracle Jdk6 in Ubuntu using Apt-get

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.