Ubuntu16.04 PPA方式安装JDK1.8
2017-11-12 20:45
435 查看
一、删除OpenJDK:
sudo apt-get purge openjdk*
二、添加PPA:
root@ubuntu:~# add-apt-repository ppa:webupd8team/java The program 'add-apt-repository' is currently not installed. You can install it by typing: apt install software-properties-common
以上提示是因为add-apt-repository命令不存在,安装即可:
apt install software-properties-common
然后在执行添加PPA的命令:
root@ubuntu:~# add-apt-repository ppa:webupd8team/java Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA. More info (and Ubuntu installation instructions): - for Oracle Java 7: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html - for Oracle Java 8: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html Debian installation instructions: - Oracle Java 7: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html - Oracle Java 8: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html Oracle Java 9 (for both Ubuntu and Debian): http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html For JDK9, the PPA uses standard builds from: https://jdk9.java.net/download/ (and not the Jigsaw builds!). Important!!! For now, you should continue to use Java 8 because Oracle Java 9 is available as an early access release (it should be released in 2016)! You should only use Oracle Java 9 if you explicitly need it, because it may contain bugs and it might not include the latest security patches! Also, some Java options were removed in JDK9, so you may encounter issues with various Java apps. More information and installation instructions (Ubuntu / Linux Mint / Debian): http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmp08u3_3hk/secring.gpg' created gpg: keyring `/tmp/tmp08u3_3hk/pubring.gpg' created gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com gpg: /tmp/tmp08u3_3hk/trustdb.gpg: trustdb created gpg: key EEA14886: public key "Launchpad VLC" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK
三、更新源:
sudo apt-get update四、安装JDK1.8:
sudo apt-get install oracle-java8-installer修改数字为6、7后,将会安装java6 (or 7)。
五、设置默认的jdk(配置环境变量):
sudo apt-get install oracle-java8-set-default同样,修改数字为6 or 7 以后,将设置默认的java版本为6 or 7
六、查看版本:
root@ubuntu:~# java -versionjava version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
版本切换:
sudo update-java-alternatives -s java-8-oracle
卸载JDK:
sudo apt-get remove oracle-java8-installer
相关文章推荐
- Ubuntu16.04安装jdk1.8(tar.gz方式)
- ubuntu 通过ppa(源) 方式安装jdk1.8
- Linux上(Ubuntu16.04上安装JDK1.8)
- ubuntu 16.04 通过ppa安装jdk
- Ubuntu16.04安装jdk1.8
- Ubuntu 16.04系统安装jdk1.8
- Ubuntu16.04上安装Java JDK1.8详细步骤
- Ubuntu 16.04 命令行下安装jdk1.8
- ubuntu16.04安装jdk1.8
- Ubuntu 16.04 64 位安装和配置 JDK 1.8
- Ubuntu Server16.04安装JDK1.8
- Linux上(Ubuntu16.04上安装JDK1.8)
- Ubuntu 16.04 配置jdk1.8 并安装eclipse
- Ubuntu16.04安装JDK1.8
- Ubuntu16.04安装配置JDK1.8
- Ubuntu16.04 LTS下安装JDK 1.8
- ubuntu下安装JDK:使用ppa/源方式安装
- Ubuntu 16.04 源码方式安装 JDK
- Linux上(Ubuntu16.04上安装JDK1.8)
- Ubuntu 16.04 安装 JDK 1.8