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

This commit is contained in:
Jun Rao 2013-05-29 20:26:08 -07:00
parent bbb161aa25
commit 436dd25a48
1 changed files with 16 additions and 0 deletions

View File

@ -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