installing oracle jdk 8 on ubuntu and fedora

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

sudo mkdir /usr/java

sudo mv jdk1.8.0_172/ /usr/java

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.8.0_172/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk1.8.0_172/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/jdk1.8.0_172/bin/javaws" 1
sudo update-alternatives --install /usr/bin/jar "jar" "/usr/java/jdk1.8.0_172/bin/jar" 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 chmod a+x /usr/bin/jar
sudo chown -R root:root /usr/java/jdk1.8.0_172

add Java home to the environment

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 for ubuntu;

sudo apt-get install jarwrapper fastjar



Leave a Reply

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