BASH Code

/BASH Code

Setting JAVA_HOME for JDK6 on Linux and OSX

Here is a useful little code snippet I use as part of BigSQL. if [ "x$JAVA_HOME" == "x" ]; then macosx_j6="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" ubuntu_j6="/usr/lib/jvm/java-6-openjdk-amd64" redhat_j6="/usr/lib/jvm/java-1.6.0-openjdk.x86_64" if [ -d "$macosx_j6" ]; then export JAVA_HOME="$macosx_j6" elif [ -d "$ubuntu_j6" ]; then export JAVA_HOME="$ubuntu_j6" elif [ -d "$redhat_j6" ]; then export JAVA_HOME="$redhat_j6" else echo "WARNING: Cannot figure out JAVA_HOME." [...]

By | April 5th, 2013|BASH Code, Java, tip|Comments Off on Setting JAVA_HOME for JDK6 on Linux and OSX

Bash Script for setting JAVA_HOME

Bash Script for setting JAVA_HOME on Linux & OSX jvmVer=java -version 2>&1 | grep "java version" | awk '{print $3}' | tr -d \" rc=$? if [ ! "$rc" == "0" ]; then echo " " echo "ERROR: JDK does not appear to be installed." exit 3 fi if [ "x$JAVA_HOME" == "x" ]; [...]

By | March 20th, 2013|BASH Code, BigSQL, Linux, OSX|Comments Off on Bash Script for setting JAVA_HOME