Here are the complete instructions to install Java, assuming you've downloaded the .bin version.
1. Browse to the directory where you want to install java and create it if it doesn't already exist, e.g. /opt/java
2. Now make sure the file is executable
sudo mkdir /opt/java
3. Start the installation process
chmod a+x /path/to/file/jre-6u14-linux-i586.bin
This displays a binary license agreement. Read through the agreement. Press the spacebar to display the next page. At the end, enter yes to proceed with the installation.
This should've created the /opt/java/jre1.6.0_14 directory.
4. Now copy the files to the /opt/java directory
5. Lastly, delete the jre1.6.0_14 subfolder
sudo cp -R /opt/java/jre1.6.0_14/* /opt/java
Now you've successfully installed Java on your system but we're far from done.
sudo rm -r /opt/java/jre1.6.0_14
6. To install the browser plugin for Firefox it's best you link to the plugin in the /opt/java/plugin/i386/ns7/ directory (in the Opera browser you can manually select the Java path via the settings section).
This should have created a symbolic link in the /usr/lib/mozilla/plugins directory. Restart Firefox (and make sure Java is enabled Go to Edit > Preferences. Under Advanced category > Select Enable Java) and test it out at: http://www.java.com/en/download/inst...tect=jre&try=1
sudo ln -s /opt/java/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins
To enable Java system-wide you'll have to add the directories to the PATH variable. Create a new shell file as root (e.g. java.sh), add the below lines to the file and save it in the "/etc/profile.d" directory.
Next time you want to upgrade Java you just have to remove the existing Java directory
And repeat steps 1 to 5.
sudo rm -r /opt/java