debian9安装java8

1.添加webupd8team Java PPA(Personal Package Archives) repository到系统里;

$ vim /etc/apt/sources.list.d/java-8-debian.list

deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main

2.在安装之前导入GPG key到系统验证包的合法性;

$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886

出现以下的错误提示:
Error:
Executing: /tmp/apt-key-gpghome.iKAAqs0hjL/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys EEA14886
gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.iKAAqs0hjL/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr

Tip:No dirmngr
提示没有dirmngr,安装dirmngr:

$ apt-get install software-properties-common dirmngr

$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886

3.apt-get update(更新索引文件);

$ apt-get update

4.安装java8;

$ apt-get install oracle-java8-installer

5.查看java版本,以及java, javac命令是否可用;

$ java -version

$ java

$ javac

6.将oracle-java8设置为默认的java环境;

$ apt-get install oracle-java8-set-default

posted @ 2017-07-02 16:32  Alwayslookingfor  阅读(10197)  评论(0编辑  收藏  举报