kafka-259; Give better error message when trying to run shell scripts without 
having built/downloaded the jars yet; patched by Ashwanth Fernando; reviewed by 
Jun Rao


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/436dd25a
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/436dd25a
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/436dd25a

Branch: refs/heads/trunk
Commit: 436dd25a4885fa13749604111000f52724eb4ccd
Parents: bbb161a
Author: Jun Rao <jun...@gmail.com>
Authored: Wed May 29 20:26:08 2013 -0700
Committer: Jun Rao <jun...@gmail.com>
Committed: Wed May 29 20:26:08 2013 -0700

----------------------------------------------------------------------
 bin/kafka-run-class.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/436dd25a/bin/kafka-run-class.sh
----------------------------------------------------------------------
diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh
index 978447d..1b66655 100755
--- a/bin/kafka-run-class.sh
+++ b/bin/kafka-run-class.sh
@@ -65,3 +65,19 @@ else
 fi
 
 $JAVA $KAFKA_OPTS $KAFKA_JMX_OPTS -cp $CLASSPATH "$@"
+
+exitval=$?
+
+if [ $exitval -eq "1" ] ; then 
+       $JAVA $KAFKA_OPTS $KAFKA_JMX_OPTS -cp $CLASSPATH "$@" >& exception.txt
+       exception=`cat exception.txt`
+       noBuildMessage='Please build the project using sbt. Documentation is 
available at http://kafka.apache.org/'
+       pattern="(Could not find or load main 
class)|(java\.lang\.NoClassDefFoundError)"
+       match=`echo $exception | grep -E "$pattern"`
+       if [[ -n "$match" ]]; then 
+               echo $noBuildMessage
+       fi
+       rm exception.txt
+fi
+
+

Reply via email to