怎样在Ubuntu 14.04中安装Java

检测是否已经安装

java -version


如果如下则没有安装

The program ‘java’ can be found in the following packages:
    * default-jre
    * gcj-4.6-jre-headless
    * openjdk-6-jre-headless
    * gcj-4.5-jre-headless
    * openjdk-7-jre-headless
    Try: sudo apt-get install

安装jre
sudo apt-get install default-jre

安装openjdk

sudo apt-get install default-jdk

安装oracle jdk

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
    sudo apt-get install oracle-java8-set-default

如果你想安装Java 7(i.e Java 1.7),在上面的命令中用java7代替java8。


参考

http://linux.cn/article-3792-1.html

http://itsfoss.com/install-java-ubuntu-1404/

https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get

你可能感兴趣的:(怎样在Ubuntu 14.04中安装Java)