Author: jfrederic.clere(a)jboss.com
Date: 2007-10-22 11:15:22 -0400 (Mon, 22 Oct 2007)
New Revision: 320
Modified:
trunk/bin/setclasspath.sh
Log:
Use any JVM that be could run in the $PATH.
Modified: trunk/bin/setclasspath.sh
===================================================================
--- trunk/bin/setclasspath.sh 2007-10-21 12:51:27 UTC (rev 319)
+++ trunk/bin/setclasspath.sh 2007-10-22 15:15:22 UTC (rev 320)
@@ -10,18 +10,29 @@
# Make sure prerequisite environment variables are set
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
- # Bugzilla 37284
- if $darwin && [ -d
"/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home" ]; then
- export
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home"
+ # Bugzilla 37284 (reviewed).
+ 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
- if [ -x /usr/bin/java ]; then
- JRE_HOME=/usr
- else
- 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
+ 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
+ # XXX: Should we try other locations?
+ 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 "$JAVA_HOME" -a "$1" = "debug" ]; then
echo "JAVA_HOME should point to a JDK in order to run in debug mode."
Show replies by date