Setting Java Home using shell script
# Use JAVA_HOME if set, otherwise look for java in PATH
if [ -x $JAVA_HOME/bin/java ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=`which java`
export JAVA_HOME=$(readlink -f $JAVA | sed "s:bin/java::")
fi
if [ -x $JAVA_HOME/bin/java ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=`which java`
export JAVA_HOME=$(readlink -f $JAVA | sed "s:bin/java::")
fi