Fix: running java examples out of tree
[lttng-ust.git] / doc / examples / java-log4j / run
1 #!/bin/bash
2
3 #
4 # The -cp path should be changed to the lttng ust agent jar file on your system
5 # or locally to the project. Same goes for the Java library path in order to
6 # find the JNI Log4j library.
7 #
8
9 DIR=`dirname $0`
10 JARFILE="liblttng-ust-agent.jar"
11 JAVA_OPTIONS=""
12
13 # If system classpath is empty, try to guess log4j location
14 if [ "x$CLASSPATH" = "x" ]; then
15 CLASSPATH="/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar"
16 fi
17
18 cd $DIR
19
20 if [ -f "$DIR/.intree" ]; then
21 CLASSPATH="../../../liblttng-ust-java-agent/java/$JARFILE:$CLASSPATH"
22 LIBPATH="../../../liblttng-ust-java-agent/jni/log4j/.libs"
23 else
24 CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$CLASSPATH"
25 # Use system defined java.library.path
26 #LIBPATH="/usr/local/lib:/usr/lib"
27 fi
28
29 if [ "x$LIBPATH" != "x" ]; then
30 JAVA_OPTIONS="$JAVA_OPTIONS -Djava.library.path=\"$LIBPATH\""
31 fi
32
33 java -classpath "$CLASSPATH:." $JAVA_OPTIONS Hello
34
35 cd -
This page took 0.032598 seconds and 4 git commands to generate.