[svlug] Sun Java and GCJ Java Wars

Chris Miller lordsauronthegreat at gmail.com
Thu Apr 5 12:10:20 PDT 2007


It's all right.  I figured it out.  Here's the end product for any who
are interested:

=========== jswitcher.sh ===============
#!/bin/sh

SUN=$1

echo "WARNING: Replacing Java files like this could be messy!  Don't
proceed unless you're ABSOLUTELY sure of the location of the SUN
Java Runtime Environment!"
echo $SUN
echo "Is this the location of the SUN Java Environment? (Y35/no)"
read response
if [ $response != "Y35" ]; then
        echo "Okay.  Exiting."
        exit 0
fi

echo "Removing old GCJ Links..."

rm -f /usr/bin/gcjjava
rm -f /usr/bin/gcjjavac
rm -f /usr/bin/gcjjavadoc
rm -f /usr/bin/gcjjavah
rm -f /usr/bin/gcjjavap
rm -f /usr/bin/gcjjava-rmi.cgi
rm -f /usr/bin/gcjjava_vm
rm -f /usr/bin/gcjjavaws

echo "Old GCJ Links removed."
echo "Creating new GCJ Links to /etc/alternatives Java replacements"

ln -s /etc/alternatives/java /usr/bin/gcjjava
ln -s /etc/alternatives/javac /usr/bin/gcjjavac
ln -s /etc/alternatives/javadoc /usr/bin/gcjjavadoc
ln -s /etc/alternatives/javah /usr/bin/gcjjavah
ln -s /etc/alternatives/javap /usr/bin/gcjjavap
ln -s /etc/alternatives/java-rmi.cgi /usr/bin/gcjjava-rmi.cgi
ln -s /etc/alternatives/java_vm /usr/bin/gcjjava_vm
ln -s /etc/alternatives/javaws /usr/bin/gcjjavaws

echo "Backup links created."
echo "Removing old /usr/bin links..."

rm -f /usr/bin/java
rm -f /usr/bin/javac
rm -f /usr/bin/javadoc
rm -f /usr/bin/javah
rm -f /usr/bin/javap
rm -f /usr/bin/java-rmi.cgi
rm -f /usr/bin/java_vm
rm -f /usr/bin/javaws

echo "Old /usr/bin links removed."
echo "Creating /usr/bin links to Sun Java..."

ln -s $SUN/bin/java /usr/bin/java
ln -s $SUN/bin/javac /usr/bin/javac
ln -s $SUN/bin/javadoc /usr/bin/javadoc
ln -s $SUN/bin/javah /usr/bin/javah
ln -s $SUN/bin/javap /usr/bin/javap
ln -s $SUN/bin/java-rmi.cgi /usr/bin/java-rmi.cgi
ln -s $SUN/bin/java_vm /usr/bin/java_vm
ln -s $SUN/bin/javaws /usr/bin/javaws

echo "/usr/bin links created.  All done!  Exiting..."
=========== jswitcher.sh =================

-- 
It's not much, but it's what I call 127.0.0.1




More information about the svlug mailing list