Install jdk in linux


By Rodrigo

Created 2014-07-23 22:31:05 Modified 2014-07-23 22:31:05

JDK, java development kit is the kit for java developers, you can compile, generate javadocs, use jconsole, and a lot of different uses for the developers, don't confuse it with JRE; JDK contains JRE, JRE only can execute java (runnable jars), can't compile or use the developers kit like jconsole or generate javadocs for instance

In this tutorial we are going to download, install and configure the JDK

this tutorial was written using the following gear:

  • Hardware:           laptop Thinkpad E430 Intel I5, 4gb Ram, 500gb HDD
  • OS:                     x86_64 GNU/Linux Ubuntu 14.10
  • Kernel:                3.13.0-32-generic


1.- Downloading the JDK:

First we need to download the JDK from the official oracle website http://www.oracle.com/technetwork/java/javase/downloads/index.html download the tar.gz version

2.- Installing the JDK:

Now we need to extract the tar.gz in /usr/lib/jvm/ if the folder doesn't exist, let's create it, do it as super user if you don't have permissions

mkdir /usr/lib/jvm/

Now go to the folder /usr/lib/jvm/

cd /usr/lib/jvm

Now extract the tar.gz here

tar -zxvf ~/Downloads/jdk1.8.0_05.tar.gz

3.- Configuring the JDK:

up to this point, we are done, we only have to configurate the java path, we have to add the JAVA_HOME path and then add this path to the PATH, let's edit the /etc/bash.bashrc file, I'm going to use nano editor

nano /etc/bash.bashrc

add the following lines at the end of the file

export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_05
export PATH=$PATH:$JAVA_HOME/bin

Now open a new terminal and type java, you'll see the following

4.- Conclusion:

Don't confuse JDK with JRE, with JDK we can compile .java files, use the jconsole and a lot things that JDK provide us

5.- Reference links:

comments powered by Disqus