Install OpenJDK8 on Ubuntu 14.04

First list the steps according to the online experts, and then record the problems encountered.
1. Add openjdk8's third-party source
sudo add-apt-repository ppa:openjdk-r/ppa
2. Execute update
apt-get update
3. Install openjdk8
sudo apt-get install openjdk-8-jdk
4. Select version
sudo update- alternatives –config Java
5. Confirm that the installation is successful
java -version
openjdk version "1.8.0_91" There


is a problem during the installation process:
Since OpenJDK8 does not explicitly support Ubuntu14.04, the first step, after execution, is a no response.
After asking the experts: You can manually modify the source list of atp.
Manually modify /etc/apt/sources.list and add the following lines at the end
## xxx added begin : for cmd-line fail(udo add-apt-repository ppa:openjdk-r/ppa)
## this ppa is used for 10.04 only.
deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu trusty main?
deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu trusty main?
## xxx added end.
Also for different Ubuntu versions, this list needs to be modified accordingly:
10.04
deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu lucid main
deb-src http://ppa.launchpad .net/openjdk-r/ppa/ubuntu lucid main


in version 12.04:
deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu precise main
deb-src http://ppa.launchpad.net/openjdk -r/ppa/ubuntu precise main
12.10
deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu quantal main
deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu quantal main


14.04
deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu trusty main
deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu trusty main


15.04
deb http:// ppa.launchpad.net/openjdk-r/ppa/ubuntu vivid main
deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu vivid main
After Ubuntu16, there is no such problem. Direct step 1? sudo add-apt-repository ppa:openjdk-r/ppa is fine.




After setting /etc/apt/sources.list as above , the first step is no longer required, and it is ok to execute directly from the second step.

When updating, it will hold an error:

Reading package list... Done
W: GPG Error: http://ppa.launchpad.net trusty InRelease: The following signature could not be verified because there is no public key: NO_PUBKEY EB9B1D8886F44E2A

不用管它。继续下一步install就可以了。



最后,记录一下Apt-get代理
设置/etc/apt/apt.conf(如果没有这个文件,创建一个):
Acquire::http::proxy "http://yourServer:yourPort/";
Acquire::ftp::proxy "ftp://yourServer:yourPort/";
Acquire::https::proxy "https://yourServer:yourPort/";
如需用户名、密码,则作如下修改:
Acquire::http::proxy "http://yourUsr:yourPwd@yourServer:yourPort/";
Acquire::ftp::proxy "ftp://yourUsr:yourPwd@yourServer:yourPort/";
Acquire::https::proxy "https://yourUsr:yourPwd@yourServer:yourPort/";




為免掠美之譏:
How to Install OpenJDK 8 in Ubuntu 14.04 & 12.04 LTS(http://sourcedigit.com/14692-install-openjdk-8-ubuntu-14-10-ubuntu-14-04-ubuntu-12-04-systems/)
Apt-get代理配置(http://blog.sina.com.cn/s/blog_72ef7bea0102vqnh.html)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325565703&siteId=291194637