diff --git a/src/parse b/src/parse index 369a14ae..9aa29cb1 100755 --- a/src/parse +++ b/src/parse @@ -7,6 +7,13 @@ JACKSON_CORE="${LIBPLCC_LIB}/lib/jackson/jackson-core-${JACKSON_VERSION}.jar" JACKSON_DATABIND="${LIBPLCC_LIB}/lib/jackson/jackson-databind-${JACKSON_VERSION}.jar" CP="${JACKSON_ANNOTATIONS}:${JACKSON_CORE}:${JACKSON_DATABIND}" +if [[ -z "${CLASSPATH:-}" ]] ; then + CLASSPATH="./Java:${CP}" + export CLASSPATH +else + CLASSPATH="./Java:${CLASSPATH}:${CP}" +fi + [ -d Java ] || { echo "Java directory missing" >&2 exit 1 @@ -33,10 +40,10 @@ then esac done - if ! java -cp "./Java:${CP}" ParseJsonAst "${ARGS[@]}" ; then + if ! java ParseJsonAst "${ARGS[@]}" ; then >&2 echo "Did you forget to pass --json_ast to plccmk?" exit 1 fi -else - java -cp ./Java Parse $* +else + java Parse $* fi diff --git a/src/plccmk b/src/plccmk index a02113ed..29786849 100755 --- a/src/plccmk +++ b/src/plccmk @@ -10,7 +10,13 @@ JACKSON_ANNOTATIONS="${LIBPLCC_LIB}/lib/jackson/jackson-annotations-${JACKSON_VE JACKSON_CORE="${LIBPLCC_LIB}/lib/jackson/jackson-core-${JACKSON_VERSION}.jar" JACKSON_DATABIND="${LIBPLCC_LIB}/lib/jackson/jackson-databind-${JACKSON_VERSION}.jar" CP="${JACKSON_ANNOTATIONS}:${JACKSON_CORE}:${JACKSON_DATABIND}" -export CLASSPATH=".:${CP}" + +if [[ -z "${CLASSPATH:-}" ]] ; then + CLASSPATH="${CP}" + export CLASSPATH +else + CLASSPATH="${CLASSPATH}:${CP}" +fi if [ "$1" = "-c" ]; then @@ -43,4 +49,3 @@ $PYTHON3 "$PLCC" $FILES || { } (cd ./Java ; javac *.java) - diff --git a/src/rep b/src/rep index 3a13e173..13eb3a5a 100755 --- a/src/rep +++ b/src/rep @@ -1,5 +1,12 @@ #!/bin/bash +if [[ -z "${CLASSPATH:-}" ]] ; then + CLASSPATH="./Java" + export CLASSPATH +else + CLASSPATH="./Java:${CLASSPATH}" +fi + [ -d "${PWD}/Java" ] || { echo "Java directory missing" >&2 exit 1 @@ -10,4 +17,4 @@ exit 2 } -java -cp ./Java Rep $* +java Rep $* diff --git a/src/scan b/src/scan index 753a66c4..3397323b 100755 --- a/src/scan +++ b/src/scan @@ -1,5 +1,13 @@ #!/bin/bash +if [[ -z "${CLASSPATH:-}" ]] ; then + CLASSPATH="./Java" + export CLASSPATH +else + CLASSPATH="./Java:${CLASSPATH}" +fi + + [ -d Java ] || { echo "Java directory missing" >&2 exit 1 @@ -10,4 +18,4 @@ exit 2 } -java -cp ./Java Scan +java Scan