#!/bin/bash
#Install Java in Fedora 13 x86_64


# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root...trying sudo:" 1>&2
   exit 1
fi

echo 'Checking to see if wget is installed...'
yum -y install wget

echo 'Downloading Java...'
wget -O jre20-x64.bin 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=39488'

echo 'Extracting Java Download...'
sh ./jre20-x64.bin

echo 'Linking Java Plugin...'
ln -s /usr/java/jre1.6.0_20/lib/amd64/libnpjp2.so /usr/lib64/mozilla/plugins/libnpjp2.so

echo 'Cleaning up downloads...'
rm ./jre20-x64.bin

echo 'Restarting Firefox...'

killall firefox
firefox 'http://www.java.com/en/download/installed.jsp?detect=jre&try=1'

