Install Java on Redhat 9.0 - How-To
Java Installation for Newbies
This is a step by step How-To which explains how to install Java for the Mozilla browser on Red Hat 9.0. I searched around the net and did not find a good Java Installation How-To for Redhat 9.0, so I decided to write my own. I hope that this How-To is written so linux newbies will be able to set up their pc to run java based websites.
The goal is to be able to run java based applications like chat rooms or games. What you are looking for is the Java Runtime Environment, as of September 2003 called J2RE v 1.4.2_01. There is also a developer's kit, called SDK, but unless you are writing java applications, you don't need it. Here is where to download the package:
http://java.com/
This may change, so Google "java downloads" if the link doesn't work. Sun is the company that maintains Java.
There is an RPM self extracting file and a plain vanilla self extracting file. This How-To covers the RPM self extracting file. I started with the file on a CD, which I downloaded on a pc with a faster internet connection, however you can also download the file directly to your pc. I would suggest creating a /usr/java directory to download it into (see below).
Assumptions:
- You have a stand alone pc, not networked
- Your account is username
- You have access to the root password
- You just want the web java, not to develop java applications
- The java installation file is on a CD disk
- You are using the RPM package download from http://java.com/
As of September 20, 2003 the current version is j2re-1_4_2_01-linux-i586-rpm.bin
Hints and Tips
Throughout the installation, remember that you can type in the first few characters of the file and hit the Tab button, and the rest of the file name will come up. This is a good way to make sure it is typed in correctly. Also note that when using a graphic file manager like Nautilus, if you want to view files and directories starting with a period, such as .mozilla, you will have to go to Nautilus and Edit/Preferences/Show hidden and backup files.
Let's Get Started
- Fire up a terminal.
- Log in as root:
[username@localhost username]$ su
Password: rootpassword
- Create the /usr/java directory if it does not yet exist:
[root@localhost username]# mkdir /usr/java
- Mount the cdrom if not already mounted
[root@localhost username]# mount /mnt/cdrom
- Check to see that the right version of java is on the CD:
[root@localhost username]# ls /mnt/cdrom
j2re-1_4_2_01-linux-i586-rpm.bin
- Copy the java file to the /usr/java directory:
[root@localhost username]# cp /mnt/cdrom/j2re-1_4_2_01-linux-i586-rpm.bin /usr/java
- Change the directory to /usr/java:
[root@localhost username]# cd /usr/java
- Set the permission of the file to allow it to be executed:
[root@localhost java] chmod 777 j2re-1_4_2_01-linux-i586-rpm.bin
- Execute the file:
[root@localhost java]# ./j2re-1_4_2_01-linux-i586-rpm.bin
- Read the license agreement and accept it by typing "yes". You may have to hit the space bar a few times to get through it. The RPM file will be extracted automatically.
- Check what is in the /usr/java directory. There should be the .bin file and the .rpm file that was just extracted from the .bin file.
[root@localhost java]# ls
j2re-1_4_2_01-linux-i586.rpm j2re-1_4_2_01-linux-i586.rpm.bin
- Run the RPM command to install the package. Note that this takes a minute or two, and that it will create a new directory in /usr/java.
[root@localhost java]# rpm -iv j2re-1_4_2_01-linux-i586.rpm
Preparing the packages for installation...
j2re-1.4.2_01-fcs
- The next step is to link your browser to the java plug in. Go back to your home directory and check to see if you have a /home/username/.mozilla/plugins directory. If you don't have the directory, make one:
[root@localhost java]# cd /home/username/.mozilla
[root@localhost .mozilla]# ls
appreg default pluginreg.dat
[root@localhost .mozilla]# mkdir plugins
[root@localhost .mozilla]# ls
appreg default pluginreg.dat plugins
- Set the permissions for /home/username/.mozilla/plugins to 777. Is this really necessary? I don't know.
chmod 777 /home/username/.mozilla/plugins
- Create a link called libjavaplugin_oji.so in the plugins directory to the file of the same name in the /usr/java directory structure. This file is what Mozilla calls on when a website needs to use Java. Be very careful with the exact text here. One small mistake and it will not work, and there is no error message. Believe me, I know.
[root@localhost .mozilla]# ln -s /usr/java/j2re1.4.2_01/plugin/i386/ns610/libjavaplugin_oji.so /home/username/.mozilla/plugins/libjavaplugin_oji.so
- If you have additional users, you will have to create a /home/username/.mozilla/plugins directory, and then create the libjavaplugin_oji.so link for each user.
- OK, you can exit your terminal session, and fire up Mozilla. Your Java plugin should now work with Mozilla. Fire up the browser, point it to any java website, and see if it works. It will take a while to load, so be patient.
I hope this works for you. I had to go to a number of different websites to figure out how to do this. I can't guarantee that this is the right way or the approved way to get java working, all I can say is that I was able to get java working on two RH9 machines. I would suggest that if you have trouble, that you try Googlng "install java on linux" and start reading webpages.