Created
November 11, 2011 02:01
-
-
Save tankchintan/1356939 to your computer and use it in GitHub Desktop.
Activation and Definition of shell script that changes Java SDK to be Sun JDK if it is OpenJSK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To be put in /etc/rc.d/rc.local | |
bash /home/ec2-user/misc/java-version-changer.sh >> /home/ec2-user/misc/java-change.log 2>&1 | |
# Contents of java-version-changer.sh that detects if openJDK is installed, if true first it will | |
# install sun jdl & then set it as the default Java SDK | |
dd="`date +%Y_%m_%d__%H_%M_%S`" | |
if [ `ls -l /etc/alternatives/java | grep openjdk | wc -l` -eq 1 ]; then | |
echo "$dd - Open JDK" | |
sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_01/bin/java 20000 | |
sudo /usr/sbin/alternatives --set java /usr/java/jdk1.7.0_01/bin/java | |
echo "$dd - Changed to Sun JDK" | |
else | |
echo "$dd - Sun JDK" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment