Install java development tools >= 8 on ubuntu linux >= 14.04

How to install java dev tools on ubuntu.
java
linux
ubuntu
Published

May 28, 2016

Hi there, I’m trying to install java development tools on my ubuntu, I skim through several guides, but none of them convinced me. All links I saw just consist on adding a repository to your apt, and then install with apt from there. But I prefer to have a deep understanding. So I went to the official download page for Java 8. And I downloaded the image called linux-x64.tar.gz The release instructions are here

Once you have the file downloaded, you have to unzip it and then move to the corresponding folder. To do so:

:~/Descargas$ tar -xvf jdk-8u92-linux-x64.tar.gz 
$ sudo mv ~/Descargas/jdk1.8.0_92 /usr/lib/jvm/

But then we need to update-alternatives to tell ubuntu that we want to work with that java. For the installation of a new program, you can check the man page for update-alternatives. To install java with symbolic link under /usr/bin/java:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_92/bin/java  1

To install javac:

sudo update-alternatives --install /usr/bin/javac java /usr/lib/jvm/jdk1.8.0_92/bin/javac 1 

Now you can check in console the installed versions:

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
jpons@bugambilla:/usr/lib/jvm/jdk1.8.0_92/bin$ javac -version
javac 1.8.0_92