From: Michael Jeanson Date: Tue, 30 Jun 2015 21:32:56 +0000 (-0400) Subject: Fix: running java examples out of tree X-Git-Tag: v2.6.3~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=eb2cc6229c0528bc52937741b61a908097bb32c4;p=lttng-ust.git Fix: running java examples out of tree Signed-off-by: Mathieu Desnoyers --- diff --git a/doc/examples/java-jul/run b/doc/examples/java-jul/run index 37a3cfdf..6deb6fd8 100755 --- a/doc/examples/java-jul/run +++ b/doc/examples/java-jul/run @@ -8,6 +8,7 @@ DIR=`dirname $0` JARFILE="liblttng-ust-agent.jar" +JAVA_OPTIONS="" cd $DIR @@ -20,6 +21,10 @@ else #LIBPATH="/usr/local/lib:/usr/lib" fi -java -classpath "$CLASSPATH:." -Djava.library.path="$LIBPATH" Hello +if [ "x$LIBPATH" != "x" ]; then + JAVA_OPTIONS="$JAVA_OPTIONS -Djava.library.path=\"$LIBPATH\"" +fi + +java -classpath "$CLASSPATH:." $JAVA_OPTIONS Hello cd - diff --git a/doc/examples/java-log4j/run b/doc/examples/java-log4j/run index 9dca6087..91f8f5d6 100755 --- a/doc/examples/java-log4j/run +++ b/doc/examples/java-log4j/run @@ -8,6 +8,7 @@ DIR=`dirname $0` JARFILE="liblttng-ust-agent.jar" +JAVA_OPTIONS="" # If system classpath is empty, try to guess log4j location if [ "x$CLASSPATH" = "x" ]; then @@ -25,6 +26,10 @@ else #LIBPATH="/usr/local/lib:/usr/lib" fi -java -classpath "$CLASSPATH:." -Djava.library.path="$LIBPATH" Hello +if [ "x$LIBPATH" != "x" ]; then + JAVA_OPTIONS="$JAVA_OPTIONS -Djava.library.path=\"$LIBPATH\"" +fi + +java -classpath "$CLASSPATH:." $JAVA_OPTIONS Hello cd -