installing oracle jdk 8 on ubuntu

tar zxvf jdk-8u151-linux-x64.tar.gz

sudo mkdir /usr/java

sudo mv jdk1.8.0_151/ /usr/java

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.8.0_151/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk1.8.0_151/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/jdk1.8.0_151/bin/javaws" 1

fix the permissions

sudo chmod a+x /usr/bin/java 
sudo chmod a+x /usr/bin/javac 
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/java/jdk1.8.0_151

sudo nano /etc/environment

and add the below line and save

export JAVA_HOME
export PATH

then issue those commands

source /etc/environment

. /etc/environment

java -version

java version “1.8.0_31”
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

javac -version

javac 1.8.0_31

To see adjusted alternatives for java, javac and javaws:

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

Additionally install these extrafiles for incase issues;

sudo apt-get install jarwrapper fastjar



Leave a Reply

Your email address will not be published. Required fields are marked *