From f77ba02420f8bf517c551db0c94051f46624cf16 Mon Sep 17 00:00:00 2001 From: jfclere Date: Sat, 27 Oct 2007 08:19:24 +0000 Subject: [PATCH] Commit the accept proposal to improve JAVA_HOME detection. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@589060 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 5 ----- bin/setclasspath.sh | 21 ++++++++++++++++++--- webapps/docs/changelog.xml | 1 + 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/STATUS b/STATUS index 260c350a9..598d62bbe 100644 --- a/STATUS +++ b/STATUS @@ -26,11 +26,6 @@ PATCHES PROPOSED TO BACKPORT: [ New proposals should be added at the end of the list ] -* Guess java location from the PATH environment. http://people.apache.org/~jfclere/patches/setclasspath.sh.patch - And improve fix for 37284. - +1: fhanik, remm, funkman, pero, jim - -1: - * Harmonize with HTTP java.io code. Otherwise the socket is not closed. http://people.apache.org/~jfclere/patches/AjpPro.patch +1: jfclere, fhanik, remm, pero, jim -1: diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index 88b44d2a7..f16df9ff4 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -26,10 +26,25 @@ CLASSPATH= # 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 + 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 diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 103ff2947..6a8589ce6 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -46,6 +46,7 @@ + Guess java location from the PATH environment and improve fix for 37284 Add NIO connector to server.xml parsing warning, remove Connector as exception case 43653Fix SSL buffer mixup when response is unable to write more than socket buffer can handle 43643If connector doesn't support external executor, display warning -- 2.11.0