diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index 978447d1754..1b666551e4b 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 + +