Saturday, October 10, 2015

Manually install Oracle Java SDK on Ubuntu

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:
  • Make a folder for your Java installs, e.g.
    sudo mkdir /usr/local/java/
  • Download & extarct there a .tar.gz from Oracle (here I will be using jdk-8u60-linux-x64.tar.gz);
  • 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/local/java/jdk1.8.0_60/
    export J2REDIR=/usr/local/java/jdk1.8.0_60/jre
    export PATH=$PATH:/usr/local/java/jdk1.8.0_60/bin:/usr/local/java/jdk1.8.0_60/db/bin:/usr/local/java/jdk1.8.0_60/jre/bin
    export JAVA_HOME=/usr/local/java/jdk1.8.0_60
    export DERBY_HOME=/usr/local/java/jdk1.8.0_60/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.

(slightly modified source)

No comments: