Oracle JDK installation in Ubuntu

Since Oracle’s Sun Java JDK packages has been removed from the Ubuntu partner repositories. Now we are left with two option:  either go with Open JDK or Oracle JDK. The fundamental difference between open jdk and oracle jdk is OpenJDK is a reference model and open source, while Oracle JDK is an implementation of the OpenJDK and is not open source and Oracle JDK is more stable than OpenJDK. I preferred Oracle JDK (more support and not buggy). Yes its true, Oracle JDK installation is little more time consuming than running direct command but it is one time activity.

Java installation in Ubuntu:-

Please follow below steps and install oracle JDK. Refer Install-Oracle-Java-on-Ubuntu-Linux (Diagrams might be helpful).
  1. First check your machine is 32 bit or 64 bit Linux box (32 bit and 64 bit refers to architecture of operating system).
    Open terminal and execute following command <file /sbin/init> and verify it is 32 bit or 64 bit.
    zytham@ubuntu:/usr/lib$ file /sbin/init
    /sbin/init: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=7a4c688d009fc1f06ffc692f5f42ab09e68582b2, stripped
    64-bit LSB indicates 64 bit OS architecture.
  2. Remove all other Java installation if any. Execute following command to remove Open JDk or others installation, its better to remove to avoid any conflict.
    zytham@ubuntu:~$ sudo apt-get purge openjdk-\*
  3. Download latest oracle JDK from oracle official website and it will be downloaded in Downloads folder of Linux box. Note,I have downloaded 64 bit oracle JDK and file name is "jdk-8u60-linux-x64.tar.gz",select the correct compressed binaries as per your OS architecture.
    Now create a new folder under /usr/local and move the downloaded JDK in that folder under and verify it has been moved successfully.Execute following command for the same in sequence.
    zytham@ubuntu:~$ sudo mkdir -p /usr/local/java
    zytham@ubuntu:~$ sudo mv /home/zytham/Downloads/jdk-8u60-linux-x64.tar.gz /usr/local/java/
    zytham@ubuntu:/usr/local/java$ ls /usr/local/java/
  4. Unpack the compressed Java binaries present in  /usr/local/java using following command and verify a new folder jdk1.x.x created.
    zytham@ubuntu:~$ cd /usr/local/java/
    zytham@ubuntu:/usr/local/java$ sudo tar -xvzf jdk-8u60-linux-x64.tar.gz 
    zytham@ubuntu:/usr/local/java$ ls
    jdk1.8.0_60  jdk-8u60-linux-x64.tar.gz
  5. Update system variable :-  Open /etc/profile using vi or gedit using following command.
    zytham@ubuntu:~$ sudo gedit /etc/profile
    Now add following line in opened file(updating system variables in PATH file) and save it. After update it should look like as following diagram.
    export JAVA_HOME
    export JRE_HOME
    export PATH
    Test whether we have updated correctly or not:- source is used to reload the file in system and that's why we are able to see recently updated value. If we do not execute first command echo $JAVA_HOME will not return any output.
    zytham@ubuntu:~$ source /etc/profile
    zytham@ubuntu:~$ echo $JAVA_HOME
  6. Now we are 2 steps away from completing java execution:- If we have multiple Java version in our system or we have Open JDK installed, we need to communicate Ubuntu Linux system where is our recently installed Oracle JDK and if we want to make it default java. Execute following command:
    1. Inform Ubuntu Linux system where our Oracle Java JDK is located.
    zytham@ubuntu:/usr/bin$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_60/jre/bin/java" 1
    [sudo] password for zytham: 
    update-alternatives: using /usr/local/java/jdk1.8.0_60/jre/bin/java to provide /usr/bin/java (java) in auto mode

    2. Inform Ubuntu Linux system that Oracle JDK must be the default Java.
    Inform your Ubuntu Linux system that Oracle JDK must be the default Java.
    zytham@ubuntu:/usr/bin$ sudo update-alternatives --set java /usr/local/java/jdk1.8.0_60/jre/bin/java
  7. It's time to test Java is in place in our system or not.Execute following command and do copy/paste sample java program in file opened and save it.
    zytham@ubuntu:~/Desktop$ gedit
    copy following sample code:-
    class Sample{
      public static void main(String []strArg){
        System.out.println("Installed   successfully!!!"); 
    Compile above java program and run using the following commands. If you have followed the steps correctly you will see the success message.
    zytham@ubuntu:~/Desktop$ javac
    zytham@ubuntu:~/Desktop$ java Sample 
    Installed successfully!!!
    zytham@ubuntu:~/Desktop$ gedit


  1. The development of artificial intelligence (AI) has propelled more programming architects, information scientists, and different experts to investigate the plausibility of a vocation in machine learning. Notwithstanding, a few newcomers will in general spotlight a lot on hypothesis and insufficient on commonsense application. machine learning projects for final year In case you will succeed, you have to begin building machine learning projects in the near future.

    Projects assist you with improving your applied ML skills rapidly while allowing you to investigate an intriguing point. Furthermore, you can include projects into your portfolio, making it simpler to get a vocation, discover cool profession openings, and Final Year Project Centers in Chennai even arrange a more significant compensation.

    Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account.

    The Nodejs Projects Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

Previous Post Next Post