How to install Java on Linux

From ArticleWorld


Java is one of the most important development platforms of the moment. While not included by default with most distributions due to its license, you can install it after you have the system up and running. The installation itself is pretty straightforward.

Steps

1. The first thing you need to do is download the Java SDK from http://java.sun.com . At the time of writing, the most recent version, 1.4.2, can be obtained on http://java.sun.com/j2se/1.4.2/download.html . Read the license to make sure you understand it.

2. On the download page, select "RPM in self-extracting file" under "Linux Platform" and download the .bin file somewhere on your computer.

3. Now login as root, open a terminal window and switch to the directory where you saved the .bin file (either by using su in a terminal or by logging in as root from the login prompt and opening a terminal window). Now type:

./<filename>

where <filename> is the exact name of the .bin file.

4. The install procedure will begin. You will be asked to accept the license before continuing. After that, the install program will decompress a .rpm file which it will leave in the same directory.

5. Now, still logged in as root, type:

rpm -ivh ./<filename>

where <filename> is the name of the new .rpm file.

6. The last step is creating two relevant symbolic links so that you don't have to modify your PATH variable. Although you can modify it, you should probably follow the symlink procedure (below) since many programs use absolute paths for the Java interpreter.

In a terminal window, type:

$ ln -s /usr/java/j2sdk1.4.2_08/bin/java /usr/bin/java 
$ ln -s /usr/java/j2sdk1.4.2_08/bin/javac /usr/bin/javac

(without the '$' sign of course).