1、sudo apt-get purge openjdk-* 2、sudo apt-get install software-properties-common 3、sudo apt autoremove 4、sudo apt-get update 5、sudo add-apt-repository ppa:webupd8team/java 6、sudo apt-get install oracle-java8-installer 7、sudo apt-get install oracle-java8-set-default 8、java -version 若第6步出现错误:Package 'oracle-java8-installer' has no installation candidate 请执行以下步骤 sudo apt-get install python-software-properties sudo add-apt-repository ppa:webupd8team/java sudo apt-get update