How to setup Java-Home and Path in Ubuntu 12.04

Solution 1:

Installation of Oracle Java:

  1. Donwload the tarball from Oracle website
  2. unzip it using this command:

    sudo tar -xvpzf fileName -C /installation_folder_name`
    
  3. change the files permission and ownership
  4. add the following two lines in /etc/profile

    export JAVA_HOME=/home/abu/Java/jdk1.8.0_45/
    export PATH=$JAVA_HOME/bin:$PATH
    

  5. restart the machine and check by java -version and javac -version