[svlug] Sun Java and GCJ Java Wars

Chris Miller lordsauronthegreat at gmail.com
Wed Apr 4 22:30:51 PDT 2007


Trying to keep the system using the Sun Java, not the GCJ Java, which
is slower.  So, I came up with this:

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

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 ==============

I have two questions:

How would I get a command line argument to use for the $SUN variable at the end?

Will this kill my system (is there anything there that is known to be
a bad idea?)

Thanks for your help!

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




More information about the svlug mailing list