Install JDK 8 and Ubuntu 14.04

Source: Internet
Author: User

Install JDK 8 and Ubuntu 14.04
Step 1: Download the JDK for Linux

You can download it from the Oracle official website or through the command line.

lxh@ubuntu:~$ wget -c http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-linux-i586.tar.gz
Step 2. Unzip and install
lxh@ubuntu:~$ mkdir -p /usr/lib/jvmlxh@ubuntu:~$ sudo mv jdk-8u11-linux-i586.tar.gz /usr/lib/jvmlxh@ubuntu:~$ cd /usr/lib/jvmlxh@ubuntu:~$ sudo tar xzvf jdk-8u11-linux-i586.tar.gzlxh@ubuntu:~$ sudo ln -s jdk1.8.0_11 java-8
Step 3: Set Environment Variables

Add environment variables to the system, including PATH, CLASSPATH, and JAVA_HOME.

lxh@ubuntu:~$ vi ~/.bashrc

Add at the end of the file

export JAVA_HOME=/usr/lib/jvm/java-8export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH

Save and exit, and run the following command to make the script take effect:

lxh@ubuntu:~$ source ~/.bashrc
Step 4: configure the default JDK version

OpenJDK is pre-installed in some systems, which is used by default, rather than just installed. Therefore, this step notifies the system to use the Oracle JDK instead of OpenJDK.

lxh@ubuntu:~$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8/bin/java 300lxh@ubuntu:~$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-8/bin/javac 300lxh@ubuntu:~$ sudo update-alternatives --config java

Because I installed Ubuntu 14.04 on a virtual machine, OpenJDK is not installed by default, so no JDK version is required. If the Ubuntu version is installed on the physical machine, several candidate items will appear, which can be used to replace java (provide/usr/bin/java ).

Select path priority status defaults 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 automatic mode 1/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 Manual mode \ * 2/usr/lib/jvm/java-6-sun/bin/java 300 manual mode \ # To maintain the current value, press Enter, alternatively, enter the selected number 2update-alternatives:/usr/lib/jvm/java-8/bin/java to provide/usr/bin/java (java) in manual mode.
Step 5: test and verify
lxh@ubuntu:~$ java -versionjava version "1.8.0_11"Java(TM) SE Runtime Environment (build 1.8.0_11-b12)Java HotSpot(TM) Client VM (build 25.11-b03, mixed mode)

An error occurred while installing jdk In ubuntu.

I remember that the downloaded JDK can be used without directly extracting it. It is an executable file that needs to be run.
You decompress the java-jdk-1.8.0, but your JAVA_HOME is jdk1.7.0 _ 40
Compressed Package content:
Correct jdk structure:



Ubuntu1404 Installation

Like you, I installed these two systems. In Windows 7, I divided 60 GB of space for Ubuntu. I used ultraISO to burn the Ubuntu installation file to a USB flash drive, then start the USB flash drive in BIOS settings and use the USB flash drive to install Ubuntu on the computer. I used this method to install Ubuntu. To access the installed Ubuntu, I also installed EasyBCD in Windows 7. For me, if you want to install the latest Ubuntu system, you can format the space where Ubuntu is located in Windows 7 and clear the startup items of Ubuntu with EasyBCD, in this way, the old Ubuntu is completely removed. To install a new one, you have to burn the Ubuntu ISO file to the USB flash disk, enable the USB flash disk in BIOS, and then install the system from the USB flash disk.
 

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.