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
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-8u31-linux-x64.tar.gz
);
- Extract it to somewhere;
tar -xvf
jdk-8u31-linux-x64.tar.gz
(64-bit)
- Move the extracted folder to
/usr/lib/jvm
. This is not required but it is the place where Java runtime software is installed
sudo mv /path/to/jdk1.8.0_31 /usr/lib/jvm/oracle_jdk8
- 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
- Make it executable:
sudo chmod +x /etc/profile.d/oraclejdk.sh
Done! Those paths will only be recognized after logout or restart, so if you want to use them right away run
source /etc/profile.d/oraclejdk.sh
.
No comments:
Post a Comment