Index: bin/solr
--- bin/solr.orig
+++ bin/solr
@@ -97,6 +97,7 @@ if [[ -z "${SOLR_INCLUDE:-}" ]]; then
   # Locations (in order) to use when searching for an include file.
   for include in "$(dirname "$0")/solr.in.sh" \
                "$HOME/.solr.in.sh" \
+	       ${SYSCONFDIR}/solr.in.sh \
                /usr/share/solr/solr.in.sh \
                /usr/local/share/solr/solr.in.sh \
                /etc/default/solr.in.sh \
@@ -147,8 +148,8 @@ elif [ -n "${JAVA_HOME:-}" ]; then
     exit 1
   fi
 else
-  JAVA=java
-  JSTACK=jstack
+  JAVA=$(${LOCALBASE}/bin/javaPathHelper -c solr)
+  JSTACK=$(${LOCALBASE}/bin/javaPathHelper -h solr)/bin/jstack
 fi
 
 : "${SOLR_STOP_WAIT:=180}"
@@ -493,7 +494,7 @@ function solr_pid_by_port() {
 # extract the value of the -Djetty.port parameter from a running Solr process
 function jetty_port() {
   SOLR_PID="$1"
-  SOLR_PROC=$(ps -fww -p "$SOLR_PID" | grep start\.jar | grep jetty\.port)
+  SOLR_PROC=$(ps -ww -o command='' -p "$SOLR_PID" | grep start\.jar | grep jetty\.port)
   IFS=' ' read -a proc_args <<< "$SOLR_PROC"
   for arg in "${proc_args[@]}"
     do
@@ -1455,13 +1456,13 @@ function start_solr() {
     fi
 
     # no lsof on cygwin though
-    if lsof -v 2>&1 | grep -q revision; then
+    if true; then
       echo -n "Waiting up to $SOLR_START_WAIT seconds to see Solr running on port $SOLR_PORT"
       # Launch in a subshell to show the spinner
       (loops=0
       while true
       do
-        running=$(lsof -t -PniTCP:$SOLR_PORT -sTCP:LISTEN || :)
+        running=$(fstat|awk "/internet stream tcp.*:$SOLR_PORT\$/ { print $3 }")
         if [ -z "${running:-}" ]; then
           slept=$((loops * 2))
           if [ $slept -lt $SOLR_START_WAIT ]; then
