Java Installation on Ubuntu 1

Below is the Installation Procedure for Oracle Java Installation on Ubuntu:

Java Installation on Ubuntu:

  • Download latest JDK version which is later than 1.6 from Oracle Site. In this installation, we used JDK 8 version. Download jdk-*-linux-x64.tar.gz zipped binary tarball for Linux 64 bit machine. Here ‘*’ refers to jdk version number for example 8 in our case.
  • Copy the JDK binary zipped tarball and Extract the zipped tarball into your preferred directory location for installation. Usually into /usr/lib/java directory.

If /usr/lib/java directory is not present, use below commands to create directory from terminal and copy the extract and unzip the files.

Set PATH Environment variable for Java access:

In Ubuntu, export PATH environment variable & JAVA_HOME environment variable by adding entry into .bashrc profile file which is present in $HOME folder by default.

Add below two lines at the bottom of .bashrc file.

Note: Here ‘:$PATH’ will make sure that java directory will be appended to existing list of directories in PATH variable instead of replacing them. So, that any other executable will also remain included. if we remove ‘:$PATH’  in the above command it will remove any existing directories from the executable path it will result in setting off to other commands. So, be careful while setting this PATH environment variable.

Update Alternatives:

By default Ubuntu may have java installed but it might be older version which we may not require. So, In order to pick your installed java version from by Ubuntu operating system automatically whenever Ubuntu is started, we need to perform below update alternatives. Run the below commands from terminal.

Now, It’s time to verify our Java installation.

Alternatively, we can install Open JDK instead of Oracle Java with below command

Verify Java Installation:

Open a new terminal to take effect of changes done to .bashrc profile file, and issue below commands in terminal to verify the java installation and you should receive message like shown below.

If you get above messages, then your java installation on Ubuntu is completed successfully.

If either of these commands gives a no such file or directory or similar
error, or if the latter mentions “Open JDK”, it’s likely your installation was not successful.

Feel free to post your error messages and I will try to respond to your posts.

Congratulations !!! You have Successfully Installed Java on a Ubuntu machine.

About Siva

Senior Hadoop developer with 4 years of experience in designing and architecture solutions for the Big Data domain and has been involved with several complex engagements. Technical strengths include Hadoop, YARN, Mapreduce, Hive, Sqoop, Flume, Pig, HBase, Phoenix, Oozie, Falcon, Kafka, Storm, Spark, MySQL and Java.

Leave a comment

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

Review Comments
default image

I have attended Siva’s Spark and Scala training. He is good in presentation skills and explaining technical concepts easily to everyone in the group. He is having excellent real time experience and provided enough use cases to understand each concepts. Duration of the course and time management is awesome. Happy that I found a right person on time to learn Spark. Thanks Siva!!!

Dharmeswaran ETL / Hadoop Developer Spark Nov 2016 September 21, 2017