#!/bin/sh
# this is really basic and does do much more then what is listed below. The java people don't
# like to allow people to repackage Java or allow anyone to distribute and they don't include
# a method for easy installation on linux or provide an ftp so scripts like the one below can
# work easier to take some of the work out of installation. This should work as long as that
# link is vaild but if not, you can always download the bin manualy and remark that first line out. 

wget -O jre-1_5_0_01-linux-i586.bin http://jdl.sun.com/webapps/download/AutoDL?BundleId=9948

# Just incase wget does set the execute flag automaticly
chmod 777 jre-1_5_0_01-linux-i586.bin

# Execute and fill out the questions it asks...
sh jre-1_5_0_01-linux-i586.bin

# Create a new home and move java to it...
mkdir /opt/java
mv jre1.5.0_01/ /opt/java/

# make it safe and useable
chown -R root:root /opt/java/jre1.5.0_01/

# KDE and somethings are staticly set to use "/usr" but SUN likes "/opt"
ln -s /opt/java /usr/java

### ---   Full Method    ---###
cp -s /opt/java/jre1.5.0_01/bin/* /usr/bin

### --- Minialist Method ---###
# set some helper links up so our apps can find it
#rm /usr/bin/java
#ln -s /opt/java/jre1.5.0_01/bin/java /usr/bin/java
#
#rm /usr/bin/java_vm
#ln -s /opt/java/jre1.5.0_01/bin/java_vm /usr/bin/java_vm

# add support for it in our bash prompts
echo  					>> /etc/bash.bashrc
echo  \# JAVA Variables			>> /etc/bash.bashrc
echo  JAVA_HOME=/opt/java/jre1.5.0_01 	>> /etc/bash.bashrc
echo  export JAVA_HOME 			>> /etc/bash.bashrc
echo  PATH=\$PATH:\$JAVA_HOME/bin	>> /etc/bash.bashrc
echo  export PATH 			>> /etc/bash.bashrc

# adds support for java to firefox.
# this may fail if you don't have firefox...
ln -s /opt/java/jre1.5.0_01/plugin/i386/ns7/libjavaplugin_oji.so \
	/usr/lib/mozilla-firefox/plugins/libjavaplugin_oji.so

