在Ubutnu14.04上安装OpenJDK8

摘自: http://source.android.com/source/initializing.html

 

Installing the JDK

The master branch of Android in the Android Open Source Project (AOSP) requires Java 8. On Ubuntu, use OpenJDK.

Java 8: For the latest version of Android

For Ubuntu >= 15.04

Run the following:

$ sudo apt-get update $ sudo apt-get install openjdk-8-jdk

For Ubuntu LTS 14.04

There are no available supported OpenJDK 8 packages for Ubuntu 14.04. The Ubuntu 15.04 OpenJDK 8 packages have been used successfully with Ubuntu 14.04. Newer package versions (e.g. those for 15.10, 16.04) were found not to work on 14.04 using the instructions below.

  1. Download the .deb packages for your architecture from http://packages.ubuntu.com/vivid/openjdk-8-jdk:

    • openjdk-8-jre-headless
    • openjdk-8-jre
    • openjdk-8-jdk
    • 这三个deb软件包我已经提前下载了,可以到http://pan.baidu.com/s/1nu4PXGl下载。

    Remember, you may obtain the architecture for your machine with:

    $ uname -m
    With x86_64 representing a 64-bit (amd64) Linux kernel architecture and i386/i486/i586/i686 representing a 32-bit (i386) system.
  2. Optionally, confirm the checksums of the downloaded files using the information found on http://packages.ubuntu.com/vivid/openjdk-8-jdk.

    For example with the sha256sum tool:

    $ sha256sum {package file}
  3. Install the packages:

    $ sudo apt-get update

    Run dpkg for each of the .deb files you downloaded. It may produce errors due to missing dependencies:

    $ sudo dpkg -i {downloaded.deb file}

    To fix missing dependencies:

    $ sudo apt-get -f install

Update the default Java version - optional

Optionally, for the Ubuntu versions above update the default Java version by running:

$ sudo update-alternatives --config java $ sudo update-alternatives --config javac

If, during a build, you encounter version errors for Java, set its path as described in the Wrong Java Version section.

To develop older versions of Android, download and install the corresponding version of the Java JDK:
Java 7: for Lollipop through Marshmallow
Java 6: for Gingerbread through KitKat
Java 5: for Cupcake through Froyo

你可能感兴趣的:(在Ubutnu14.04上安装OpenJDK8)