`

how-to-install-oracle-java-on-ubuntu-14-04

 
阅读更多

Using a PPA

You can use WebUpd8 PPA (this will download the required files from Oracle and install JDK 8):

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

Are PPA's safe to add to my system and what are some “red flags” to watch out for?

Also ensure your JAVA_HOME variable has been set to:

/usr/lib/jvm/java-8-oracle

For this you can use the following command (see step 3 of Manual Install to see how to make it permanent):

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

Manual install

The tar.gz provided by Oracle don't have an actual installation process. You just extract those files to a location you want and add them to your path. So the process is the following:

  • Download a .tar.gz from Oracle (here I will be using jdk-8u20-linux-x64.tar.gz);
  • Extract it to somewhere;
  • Move the extracted folder to /usr/lib/jvm. This is not required but it is the place where Java runtime software is installed, and where tools like IDE's may search for it:

    sudo mv /path/to/jdk1.8.0_20 /usr/lib/jvm/oracle_jdk8
  • Before addin this jdk as an alternative, you can see that the new alternative is not listed:

    sudo update-alternatives --query java
    
    sudo update-alternatives --query javac
  • Next, add the new jdk alternatives (2000 is the priority and feel free to pick a different number):

    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/oracle_jdk8/jre/bin/java 2000
    
    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/oracle_jdk8/bin/javac 2000
  • Now you should see the new jdk listed and you can switch between the alternatives with this command:

    sudo update-alternatives --config java
    
    sudo update-alternatives --config javac
  • Create a file /etc/profile.d/oraclejdk.sh with the following content (adapt the paths to reflect the path where you stored your JDK):

    export J2SDKDIR=/usr/lib/jvm/oracle_jdk8
    export J2REDIR=/usr/lib/jvm/oracle_jdk8/jre
    export PATH=$PATH:/usr/lib/jvm/oracle_jdk8/bin:/usr/lib/jvm/oracle_jdk8/db/bin:/usr/lib/jvm/oracle_jdk8/jre/bin
    export JAVA_HOME=/usr/lib/jvm/oracle_jdk8
    export DERBY_HOME=/usr/lib/jvm/oracle_jdk8/db

Done! Those paths will only be recognized after you logout or restart, so if you want to use them right away run source /etc/profile.d/oraclejdk.sh.

分享到:
评论

相关推荐

    java8源码-Hebe-Block:白块

    `http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html` - *FreeBSD* - `pkg install openjdk8` - *CentOS - `yum install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64` ...

    java8源码-ngp:从NXT区块链克隆,v1.11.5

    `http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html` - *FreeBSD* - `pkg install openjdk8` - *CentOS - `yum install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64` ...

    XponzCore:生的

    依赖项: 一般-Java 8 Ubuntu - http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html Debian - http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html FreeBSD -...

    OmnisChain

    Debian - http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html FreeBSD - pkg install openjdk8 运行! 单击OMN图标,或从命令行开始: Unix: ./start.sh 视窗: run.bat 等待...

    jupiter:区块链是最先进的技术,能够解决社会上许多基本问题。 使用Jupiter,我们努力使所有人都能使用该技术

    Debian - http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html FreeBSD - pkg install openjdk8 MacOS (从终端) brew tap AdoptOpenJDK/openjdk brew install --cas

    nxt:用于 NXTcoin 开发的 Ziftr 存储库

    欢迎来到 Nxt! 什么是NXT? ... 使用 Nxt,您可以管理和交互 你的资产 你的生意 ... Debian - http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html 存储库- git clone https://b

    nxt:为 MofoWallet 扩展 NXT

    欢迎来到 Nxt! 什么是NXT? ... 使用 Nxt,您可以管理和交互 你的资产 你的生意 ... Debian - http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html 存储库- git clone https://b

    hydra 7.2 win32

    If you use Ubuntu, this will install supplementary libraries needed for a few optional modules: apt-get install libssl-dev libssh-dev libidn11-dev libpcre3-dev \ libgtk2.0-dev libmysqlclient-dev ...

Global site tag (gtag.js) - Google Analytics