X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcustomize%2Ffred%2Fjava_profile.sh;h=f98030a679856d2d5dcec81fa4dcb87fabe4e23a;hb=714f07e34483e14aa4a91047b8891463267ae568;hp=30128a22c96e3b6958d995611914e369df750237;hpb=450337ae1ed04f16ee6e4889532a0b497b34674a;p=feisty_meow.git diff --git a/scripts/customize/fred/java_profile.sh b/scripts/customize/fred/java_profile.sh index 30128a22..f98030a6 100644 --- a/scripts/customize/fred/java_profile.sh +++ b/scripts/customize/fred/java_profile.sh @@ -6,14 +6,14 @@ ############################ -source $FEISTY_MEOW_SCRIPTS/core/functions.sh +source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" # this reports when we have totally failed to figure out where a folder # is actually located on the machine. function intuition_failure() { missing="$1"; shift - if [ ! -z "$SHELL_DEBUG" ]; then + if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo "Could not intuit '$missing' variable." fi # remove the variable because its value is busted. @@ -22,16 +22,24 @@ function intuition_failure() ############################ -# set some fairly liberal limits for ant. -#no. export ANT_OPTS="-Xms512m -Xmx768m -XX:MaxPermSize=768m" - -############################ - # start guessing some settings... +# whatever we figure out, we want to export the java home variable. +export JAVA_HOME + # this bin portion works for most javas... export JAVA_BIN_PIECE=bin +# try using java itself to locate the JAVA_HOME if we can. +if [ ! -d "$JAVA_HOME" ]; then + JAVA_HOME=$(java -XshowSettings:properties -version 2>&1 | grep -i java.home | sed -e 's/.*java.home = \(.*\)$/\1/') +fi + +# if that didn't work, then we try a series of random bizarro places where +# we have seen java live before. + +#hmmm: below list is way out of date. we really hope the first attempt above works. + if [ ! -d "$JAVA_HOME" ]; then # try a recent version. export JAVA_HOME=/usr/lib/jvm/java-8-oracle @@ -65,7 +73,7 @@ fi if [ ! -d "$JAVA_HOME" ]; then unset JAVA_HOME unset JAVA_BIN_PIECE - if [ -z "$(whichable java 2>/dev/null)" ]; then + if [ -z "$(whichable java)" ]; then intuition_failure JAVA_HOME fi fi @@ -80,7 +88,7 @@ if [ ! -d "$ECLIPSE_DIR" ]; then ECLIPSE_DIR=$HOME/eclipse fi if [ ! -d "$ECLIPSE_DIR" ]; then - ECLIPSE_DIR=$HOME/apps/eclipse + ECLIPSE_DIR=/usr/local/fred/eclipse fi if [ ! -d "$ECLIPSE_DIR" ]; then ECLIPSE_DIR="c:/tools/eclipse" @@ -104,7 +112,7 @@ else ECLIPSE_DIR=$(echo $ECLIPSE_DIR | sed -e 's/^\(.\):/\/cygdrive\/\1/') fi fi -if [ -z "$ECLIPSE_DIR" -a -z "$(whichable eclipse 2>/dev/null)" ]; then +if [ -z "$ECLIPSE_DIR" -a -z "$(whichable eclipse)" ]; then intuition_failure ECLIPSE_DIR fi