How to install and configure java in Linux

Download Java package or Java source for Linux from Java homepage. There is a Java RPM package for Redhat-based distributions. Choose that if you are using Fedora Linux or other Redhat-based Linux distributions. If you are using Slackware Linux, choose the Linux (self-extracting file). See the screenshot example below:

Download java for Linux screenshot image

When the download is finished, copy the Java file to the /usr/local/src directory or whatever directory you choose to install third party software in your Linux system.

[email protected]:~# cp /home/luzar/Desktop/jre-6u12-linux-i586.bin
/usr/local/src/

The Java file does not have execute permission by default. So, to extract Java, give execute permission like the example below:

[email protected]:/usr/local/src# ls -l
total 19728
-rw-r--r-- 1 luzar users 20168773 2009-03-11 21:42 jre-6u12-linux-i586.bin
drwxr-xr-x 7 root root 4096 2008-10-13 03:48 vmware-tools-distrib/
[email protected]:/usr/local/src# chmod a+x jre-6u12-linux-i586.bin
[email protected]:/usr/local/src# ls -l
total 19728
-rwxr-xr-x 1 luzar users 20168773 2009-03-11 21:42 jre-6u12-linux-i586.bin*
drwxr-xr-x 7 root root 4096 2008-10-13 03:48 vmware-tools-distrib/
[email protected]:/usr/local/src#

Now we can extract Java file by running the command below:

[email protected]:/usr/local/src# ./jre-6u12-linux-i586.bin

Read the license agreement and press space bar to move to the next screen. At the bottom of the license agreement you need to answer yes to agree to the terms and install the software.

Do you agree to the above license terms? [yes or no]
yes

It only takes a few seconds to extract the Java file. When it's done, we can start configure Java for our Linux system.

Configure Java in Mozilla Firefox

Change directory to the /usr/lib/firefox/plugins. If your firefox directory has version number, than provide that version number.

[email protected]:/usr/local/src# cd /usr/lib/firefox-3.0.6/plugins/
[email protected]:/usr/lib/firefox-3.0.6/plugins# ls
libnullplugin.so*
[email protected]:/usr/lib/firefox-3.0.6/plugins#

In firefox 'plugins' directory, create a symbolic link to the Java installation directory. See the example below:

[email protected]:/usr/lib/firefox-3.0.6/plugins# ln -s /usr/local/src/jre1.6.0_12
/plugin/i386/ns7/libjavaplugin_oji.so .

[email protected]:/usr/lib/firefox-3.0.6/plugins# ls
[email protected] libnullplugin.so*
[email protected]:/usr/lib/firefox-3.0.6/plugins#

Open firefox and click Tools menu, then choose Add-ons. Click plugins tab to confirm that Java Console is there. See an example screenshot below:

Check java installed screenshot image

To test Java, open Java test page in Java website link below:

Verify java installation.

Test java screenshot image

Finish.

Add new comment