Debian 9 oracle java environment
安装oracle提供的java8环境
一. 配置源
$ sudo vi /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
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
可能会报错
➜ ~ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
Executing: /tmp/apt-key-gpghome.PTWZ4ixZ5e/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys EEA14886
gpg: failed to start the dirmngr '/usr/bin/dirmngr': 没有那个文件或目录
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.PTWZ4ixZ5e/S.dirmngr' failed: 没有那个文件或目录
gpg: keyserver receive failed: No dirmngr
解决办法
$ sudo apt-get install dirmngr
二. 安装
更新源 ``sh $ sudo apt-get update
查看
```sh
$ sudo apt-cache search oracle-java
oracle-java8-installer - Oracle Java(TM) Development Kit (JDK) 8
oracle-java8-set-default - Set Oracle JDK 8 as default Java
oracle-java8-unlimited-jce-policy - Unlimited JCE Policy for Oracle Java 8
安装
$ sudo apt-get install oracle-java8-installer
安装过程中会有两个选择[是]
安装完成后验证安装结果
$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
删除openjdk
$ dpkg -l | grep openjdk
ii openjdk-8-jre:amd64 8u212-b01-1~deb9u1 amd64 OpenJDK Java runtime, using Hotspot JIT
ii openjdk-8-jre-headless:amd64 8u212-b01-1~deb9u1 amd64 OpenJDK Java runtime, using Hotspot JIT (headless)
$ sudo apt-get remove openjdk-8-jre openjdk-8-jre-headless