To install Java in Linux, refer the following instructions:

1. Download the 32bit or 64bit compressed binary “.tar.gz” file from here.

2. Create a system directory like /usr/lib/jvm  to install JDK and copy the tar file to the directory.


3. Change the present working directory to the installation directory and extract the contents of the tar file using the following command.

The name of the jdk folder will be like jdk1.7.0_03. 


4. Create the JAVA_HOME environment variable and add JDK bin path to the system PATH variable. Open /etc/environment file in an editor using sudo option.

Update the PATH variable and add the JAVA_HOME seting to the file

To exit the editor, press ctrl+x and save your changes. Now, source the /etc/environment file to refresh the values of environment variables


5. Run following update commands to update the default java commands to use the installed JDK:


6. Correct the file ownership and the permissions of the executables:


7. Check the version of your new JDK 7 installation:


Continue reading more Linux blogs, click here.

Share this:

One thought on “Install Java in Linux

Leave a Reply

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