Permalink
Browse files

JRUBY-5266: Heed $JAVACMD variable if set to control which JVM progra…

…m name to use
  • Loading branch information...
1 parent c1d0da5 commit 977c546d90e92872905e396d949c2fb6bc64661c @nicksieger nicksieger committed Jan 10, 2011
Showing with 25 additions and 25 deletions.
  1. +12 −14 bin/jruby.bash
  2. +13 −11 bin/jruby.sh
View
@@ -80,16 +80,14 @@ JRUBY_OPTS=${JRUBY_OPTS_TEMP}
if [ -z "$JAVACMD" ] ; then
if [ -z "$JAVA_HOME" ] ; then
- JAVA_CMD='java'
+ JAVACMD='java'
else
if $cygwin; then
- JAVA_CMD="`cygpath -u "$JAVA_HOME"`/bin/java"
+ JAVACMD="`cygpath -u "$JAVA_HOME"`/bin/java"
else
- JAVA_CMD="$JAVA_HOME/bin/java"
+ JAVACMD="$JAVA_HOME/bin/java"
fi
fi
-else
- JAVA_CMD=$JAVACMD
fi
if [ -z "$JAVA_MEM" ] ; then
@@ -123,7 +121,7 @@ JAVA_OPTS=$JAVA_OPTS_TEMP
# If you're seeing odd exceptions, you may have a bad JVM install.
# Uncomment this and report the version to the JRuby team along with error.
-#$JAVA_CMD -version
+#$JAVACMD -version
JRUBY_SHELL=/bin/sh
@@ -206,11 +204,11 @@ do
elif [ "${val:0:4}" = "-Xss" ]; then
JAVA_STACK=$val
elif [ "${val}" = "" ]; then
- $JAVA_CMD -help
+ $JAVACMD -help
echo "(Prepend -J in front of these options when using 'jruby' command)"
exit
elif [ "${val}" = "-X" ]; then
- $JAVA_CMD -X
+ $JAVACMD -X
echo "(Prepend -J in front of these options when using 'jruby' command)"
exit
elif [ "${val}" = "-classpath" ]; then
@@ -251,12 +249,12 @@ do
# Run under JDB
--jdb)
if [ -z "$JAVA_HOME" ] ; then
- JAVA_CMD='jdb'
+ JAVACMD='jdb'
else
if $cygwin; then
- JAVA_CMD="`cygpath -u "$JAVA_HOME"`/bin/jdb"
+ JAVACMD="`cygpath -u "$JAVA_HOME"`/bin/jdb"
else
- JAVA_CMD="$JAVA_HOME/bin/jdb"
+ JAVACMD="$JAVA_HOME/bin/jdb"
fi
fi
java_args=("${java_args[@]}" "-sourcepath" "$JRUBY_HOME/lib/ruby/1.8:.")
@@ -346,7 +344,7 @@ if [ "$VERIFY_JRUBY" != "" ]; then
echo "Running with instrumented profiler"
fi
- "$JAVA_CMD" $PROFILE_ARGS $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -classpath "$JRUBY_CP$CP_DELIMITER$CP$CP_DELIMITER$CLASSPATH" \
+ "$JAVACMD" $PROFILE_ARGS $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -classpath "$JRUBY_CP$CP_DELIMITER$CP$CP_DELIMITER$CLASSPATH" \
"-Djruby.home=$JRUBY_HOME" \
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
"-Djruby.shell=$JRUBY_SHELL" \
@@ -369,7 +367,7 @@ if [ "$VERIFY_JRUBY" != "" ]; then
else
if $cygwin; then
# exec doed not work correctly with cygwin bash
- "$JAVA_CMD" $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
+ "$JAVACMD" $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
"-Djruby.home=$JRUBY_HOME" \
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
"-Djruby.shell=$JRUBY_SHELL" \
@@ -382,7 +380,7 @@ else
exit $JRUBY_STATUS
else
- exec "$JAVA_CMD" $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
+ exec "$JAVACMD" $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
"-Djruby.home=$JRUBY_HOME" \
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
"-Djruby.shell=$JRUBY_SHELL" \
View
@@ -73,15 +73,17 @@ for opt in ${JRUBY_OPTS[@]}; do
done
JRUBY_OPTS=${JRUBY_OPTS_TEMP}
-if [ -z "$JAVA_HOME" ] ; then
- JAVA_CMD='java'
-else
- JAVA_CMD="$JAVA_HOME/bin/java"
+if [ -z "$JAVACMD" ] ; then
+ if [ -z "$JAVA_HOME" ] ; then
+ JAVACMD='java'
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
fi
# If you're seeing odd exceptions, you may have a bad JVM install.
# Uncomment this and report the version to the JRuby team along with error.
-#$JAVA_CMD -version
+#$JAVACMD -version
JRUBY_SHELL=/bin/sh
@@ -161,11 +163,11 @@ do
elif [ "${val:0:4}" = "-Xss" ]; then
JAVA_STACK=$val
elif [ "${val}" = "" ]; then
- $JAVA_CMD -help
+ $JAVACMD -help
echo "(Prepend -J in front of these options when using 'jruby' command)"
exit
elif [ "${val}" = "-X" ]; then
- $JAVA_CMD -X
+ $JAVACMD -X
echo "(Prepend -J in front of these options when using 'jruby' command)"
exit
elif [ "${val}" = "-classpath" ]; then
@@ -206,9 +208,9 @@ do
# Run under JDB
--jdb)
if [ -z "$JAVA_HOME" ] ; then
- JAVA_CMD='jdb'
+ JAVACMD='jdb'
else
- JAVA_CMD="$JAVA_HOME/bin/jdb"
+ JAVACMD="$JAVA_HOME/bin/jdb"
fi
java_args="${java_args} -sourcepath $JRUBY_HOME/lib/ruby/1.8:."
JRUBY_OPTS="${JRUBY_OPTS} -X+C" ;;
@@ -279,7 +281,7 @@ if [ "$VERIFY_JRUBY" != "" ]; then
echo "Running with instrumented profiler"
fi
- "$JAVA_CMD" $PROFILE_ARGS $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -classpath "$JRUBY_CP$CP_DELIMITER$CP$CP_DELIMITER$CLASSPATH" \
+ "$JAVACMD" $PROFILE_ARGS $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -classpath "$JRUBY_CP$CP_DELIMITER$CP$CP_DELIMITER$CLASSPATH" \
"-Djruby.home=$JRUBY_HOME" \
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
"-Djruby.shell=$JRUBY_SHELL" \
@@ -297,7 +299,7 @@ if [ "$VERIFY_JRUBY" != "" ]; then
exit $JRUBY_STATUS
else
- exec $JAVA_CMD $JAVA_OPTS $JFFI_OPTS ${java_args} -Xbootclasspath/a:$JRUBY_CP -classpath $CP$CP_DELIMITER$CLASSPATH \
+ exec $JAVACMD $JAVA_OPTS $JFFI_OPTS ${java_args} -Xbootclasspath/a:$JRUBY_CP -classpath $CP$CP_DELIMITER$CLASSPATH \
-Djruby.home=$JRUBY_HOME \
-Djruby.lib=$JRUBY_HOME/lib -Djruby.script=jruby \
-Djruby.shell=$JRUBY_SHELL \

0 comments on commit 977c546

Please sign in to comment.