Installing java 8 version in Ubuntu 14.04 and require jdk8. After extracting files from jdk 1.8.0 tar package from oracle java page and moving it to usr/lib/jvm
, I am unable to find the oracle_jdk8 directory.

- 70,465
1 Answers
I downloaded jdk-8u131-linux-x64.tar.gz from Oracle's site. There is no oracle_jdk8 inside it. Do you mean you moved the JDK main directory as /usr/lib/jvm/oracle_jdk8/, in effect renaming it?
Have you installed the package java-common? After installing java-common and downloading the jdk tar to say ~/Downloads, try these steps (adapted from instructions at http://www.devsniper.com/install-jdk-8-on-ubuntu/):
cd ~/Downloads/
tar -xzf jdk-8u131-linux-x64.tar.gz
sudo mkdir /usr/lib/jvm/
sudo mv jdk1.8.0_131 /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_131/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_131/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.0_131/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.8.0_131/bin/jar 1
You can do the same for other Java binary commands such as jconsole etc.
If you have other jdk's installed, run next these:
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws
Test the Java version:
java -version
java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
Some tools require the JAVA_HOME variable. I suggest setting this in your non-root user's .bashrc and/or .profile, e.g.:
echo "export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_131" >> ~/.bashrc
If you use update-alternatives as instructed above, you don't necessarily need to change the PATH variable, since update-alternatives creates a symlink for the specified command to /usr/bin/ which points to /usr/etc/alternatives/ which points to the real binary location.
So, only change PATH, if you want all the commands in the bin directory to be found, and don't want to issue update-alternatives for all (or any of them). If you update the JDK, remember to update JAVA_HOME and if you channged it, also PATH, in .bashrc and/or .profile. To change PATH in .bashrc:
echo "export PATH=$JAVA_HOME/bin:$PATH" >> ~/.bashrc