Created
June 8, 2011 17:48
-
-
Save vshank77/1014916 to your computer and use it in GitHub Desktop.
set java shell
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
| #!/bin/sh | |
| if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then | |
| if $darwin; then | |
| if [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then | |
| export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" | |
| fi | |
| else | |
| JAVA_PATH=`which java 2>/dev/null` | |
| if [ "x$JAVA_PATH" != "x" ]; then | |
| JAVA_PATH=`dirname $JAVA_PATH 2>/dev/null` | |
| JRE_HOME=`dirname $JAVA_PATH 2>/dev/null` | |
| fi | |
| if [ "x$JRE_HOME" = "x" ]; then | |
| if [ -x /usr/bin/java ]; then | |
| JRE_HOME=/usr | |
| fi | |
| fi | |
| fi | |
| if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then | |
| echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined" | |
| echo "At least one of these environment variable is needed to run this program" | |
| exit 1 | |
| fi | |
| fi | |
| if [ -z "$JRE_HOME" ]; then | |
| JRE_HOME="$JAVA_HOME" | |
| fi | |
| if [ -z "$BASEDIR" ]; then | |
| echo "The BASEDIR environment variable is not defined" | |
| echo "This environment variable is needed to run this program" | |
| exit 1 | |
| fi | |
| if [ ! -x "$BASEDIR"/bin/setjava.sh ]; then | |
| if $os400; then | |
| eval | |
| else | |
| echo "The BASEDIR environment variable is not defined correctly" | |
| echo "This environment variable is needed to run this program" | |
| exit 1 | |
| fi | |
| fi | |
| # Set standard commands for invoking Java. | |
| _RUNJAVA="$JRE_HOME"/bin/java |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment