You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by el...@apache.org on 2015/01/24 01:07:26 UTC

svn commit: r1654436 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/CHANGES.txt solr/bin/ solr/bin/solr

Author: elyograg
Date: Sat Jan 24 00:07:25 2015
New Revision: 1654436

URL: http://svn.apache.org/r1654436
Log:
SOLR-7024: bin/solr: Improve java detection and error messages (merge trunk r1654434)

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/bin/   (props changed)
    lucene/dev/branches/branch_5x/solr/bin/solr

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1654436&r1=1654435&r2=1654436&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Sat Jan 24 00:07:25 2015
@@ -498,6 +498,10 @@ Bug Fixes
 * SOLR-6856: Restore ExtractingRequestHandler's ability to capture all HTML tags when
   parsing (X)HTML. (hossman, ehatcher, Steve Rowe)
 
+* SOLR-7024: Improved error messages when java is not found by the bin/solr
+  shell script, particularly when JAVA_HOME has an invalid location.
+  (Shawn Heisey)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/branch_5x/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/bin/solr?rev=1654436&r1=1654435&r2=1654436&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/bin/solr (original)
+++ lucene/dev/branches/branch_5x/solr/bin/solr Sat Jan 24 00:07:25 2015
@@ -119,12 +119,27 @@ elif [ -n "$JAVA_HOME" ]; then
       break
     fi
   done
+  if [ -z "$JAVA" ]; then
+    echo >&2 "The currently defined JAVA_HOME ($JAVA_HOME) refers"
+    echo >&2 "to a location where Java could not be found.  Aborting."
+    echo >&2 "Either fix the JAVA_HOME variable or remove it from the"
+    echo >&2 "environment so that the system PATH will be searched."
+    exit 1
+  fi
 else
   JAVA=java
 fi
 
 # test that Java exists and is executable on this server
-$JAVA -version >/dev/null 2>&1 || { echo >&2 "Java is required to run Solr! Please install Java 7 or 8 before running this script."; exit 1; }
+$JAVA -version >/dev/null 2>&1 || {
+  echo >&2 "Java not found, or an error was encountered when running java."
+  echo >&2 "A working Java 8 is required to run Solr!"
+  echo >&2 "Please install Java 8 or fix JAVA_HOME before running this script."
+  echo >&2 "Command that we tried: '${JAVA} -version'"
+  echo >&2 "Active Path:"
+  echo >&2 "${PATH}"
+  exit 1
+}
 
 # URL scheme for contacting Solr
 SOLR_URL_SCHEME=http