forked from btraceio/btrace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbtrace
More file actions
executable file
·47 lines (43 loc) · 1.86 KB
/
btrace
File metadata and controls
executable file
·47 lines (43 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /bin/sh
if [ -z "$BTRACE_HOME" -o ! -d "$BTRACE_HOME" ] ; then
# resolve links - $0 could be a link to btrace's home
PRG="$0"
progname=`basename "$0"`
BTRACE_HOME=`dirname "$PRG"`/..
BTRACE_HOME=`cd "$BTRACE_HOME" && pwd`
fi
if [ -f "${BTRACE_HOME}/build/btrace-client.jar" ] ; then
if [ "${JAVA_HOME}" != "" ]; then
TOOLS_JAR="${JAVA_HOME}/lib/tools.jar"
if [ ! -f ${TOOLS_JAR} ] ; then
case "`uname`" in
Darwin*)
# In older JDK versions for Mac OS X, tools.jar is classes.jar
# and is kept in a different location. Check if we can locate
# classes.jar based on ${JAVA_VERSION}
TOOLS_JAR="/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Classes/classes.jar"
# if we can't find, try relative path from ${JAVA_HOME}. Usually,
# /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
# is JAVA_HOME. (or whatever version beyond 1.6.0!)
if [ ! -f ${TOOLS_JAR} ] ; then
TOOLS_JAR="${JAVA_HOME}/../Classes/classes.jar"
fi
# If we still can't find, tell the user to set JAVA_VERSION.
# This way, we can avoid zip file errors from the agent side
# and "connection refused" message from client.
if [ ! -f ${TOOLS_JAR} ] ; then
echo "Please set JAVA_VERSION to the target java version"
exit 1
fi
;;
esac
fi
${JAVA_HOME}/bin/java -cp ${BTRACE_HOME}/build/btrace-client.jar:${TOOLS_JAR}:/usr/share/lib/java/dtrace.jar com.sun.btrace.client.Main $*
else
echo "Please set JAVA_HOME before running this script"
exit 1
fi
else
echo "Please set BTRACE_HOME before running this script"
exit 1
fi