blob: a340dd7d93e3ad7a8083687a66b2d97a1b6ef1f8 [file] [log] [blame]
Jonathan Hartfe990382013-02-06 15:22:32 -08001#!/bin/bash
2
HIGUCHI Yuta88f3bf32013-06-20 10:37:47 -07003if [ -z "${MVN}" ]; then
4 MVN="mvn"
5fi
6
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -08007BASE_DIR=`dirname $0`
HIGUCHI Yutae7aa9252013-06-06 14:54:21 -07008ONOS_DIR="`dirname $0`/.."
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -08009
10# Use a python script to parse the classpath out of the .classpath file
Yuta HIGUCHI8d9723d2013-12-21 00:10:07 -080011if [ ! -f ${ONOS_DIR}/.javacp ]; then
12 echo "execute mvn compile at ONOS HOME directory."
13 exit 1
14fi
15CP=`cat ${ONOS_DIR}/.javacp`
16CP="${CP}:${ONOS_DIR}/target/classes"
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -080017
18if [[ "$CP" == *"Error reading classpath file"* ]]; then
19 echo $CP
20 exit 1
21fi
Jonathan Hartfe990382013-02-06 15:22:32 -080022
23# Find Java
24if [ "$JAVA_HOME" = "" ] ; then
25 JAVA="java -server"
26else
27 JAVA="$JAVA_HOME/bin/java -server"
28fi
29
30# Set Java options
31if [ "$JAVA_OPTIONS" = "" ] ; then
32 JAVA_OPTIONS="-Xms32m -Xmx512m"
33fi
34
35# Launch the application
36if [ "$1" = "-e" ]; then
37 k=$2
38 if [ $# -gt 2 ]; then
39 for (( i=3 ; i < $# + 1 ; i++ ))
40 do
41 eval a=\$$i
42 k="$k \"$a\""
43 done
44 fi
45
46 eval $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.ScriptExecutor $k
47else
48 if [ "$1" = "-v" ]; then
49 $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.tinkerpop.gremlin.Version
50 else
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -080051 pushd $BASE_DIR >/dev/null
Jonathan Hartfe990382013-02-06 15:22:32 -080052 $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.Console
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -080053 popd >/dev/null
Jonathan Hartfe990382013-02-06 15:22:32 -080054 fi
55fi
56
57# Return the program's exit code
58exit $?