diff --git a/resources/bin/ballerina b/resources/bin/ballerina index a35ba0aa..dbca20e6 100755 --- a/resources/bin/ballerina +++ b/resources/bin/ballerina @@ -21,6 +21,15 @@ else CURRENT_PATH="$(dirname "$(readlink -f "$0")")" fi +JAVA_COMMAND=java +if test -d "$CURRENT_PATH/../dependencies/jdk-11.0.8+10-jre"; then + JAVA_COMMAND="$CURRENT_PATH/../dependencies/jdk-11.0.8+10-jre/bin/java" +elif test -d "$CURRENT_PATH/../dependencies/jdk8u265-b01-jre"; then + JAVA_COMMAND="$CURRENT_PATH/../dependencies/jdk8u265-b01-jre/bin/java" +elif test -d "$CURRENT_PATH/../dependencies/jdk8u202-b08-jre"; then + JAVA_COMMAND="$CURRENT_PATH/../dependencies/jdk8u202-b08-jre/bin/java" +fi + RUN_COMMAND=false RUN_BALLERINA=true @@ -38,10 +47,6 @@ fi if [ "$RUN_COMMAND" == "true" ] then - JAVA_COMMAND=java - if test -d "$CURRENT_PATH/../dependencies/jdk-11.0.8+10-jre"; then - JAVA_COMMAND="$CURRENT_PATH/../dependencies/jdk-11.0.8+10-jre/bin/java" - fi if [ "$1" == "build" ] then $JAVA_COMMAND -jar $CURRENT_PATH/../lib/ballerina-command-@version@.jar build @@ -85,10 +90,6 @@ fi if [ "$1" == "help" ] && [ "$2" == "" ] || [ "$1" == "" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ] || \ [ "$1" == "version" ] || [ "$1" == "-v" ] || [ "$1" == "--version" ] then - JAVA_COMMAND=java - if test -d "$CURRENT_PATH/../dependencies/jdk-11.0.8+10-jre"; then - JAVA_COMMAND="$CURRENT_PATH/../dependencies/jdk-11.0.8+10-jre/bin/java" - fi $JAVA_COMMAND -jar $CURRENT_PATH/../lib/ballerina-command-@version@.jar "$@" exit $? else diff --git a/resources/bin/ballerina.bat b/resources/bin/ballerina.bat index d605e3c5..875746fe 100644 --- a/resources/bin/ballerina.bat +++ b/resources/bin/ballerina.bat @@ -38,9 +38,17 @@ SetLocal EnableDelayedExpansion if exist %CURRENT_PATH%..\dependencies\jdk-11.0.8+10-jre ( set JAVA_CMD=%CURRENT_PATH%..\dependencies\jdk-11.0.8+10-jre\bin\java ) else ( - if not exist "%JAVA_HOME%" ( - echo Compatible JRE not found. Please follow the instructions in ^\INSTALL.txt to install and setup Ballerina. - exit /b + if exist %CURRENT_PATH%..\dependencies\jdk8u265-b01-jre ( + set JAVA_CMD=%CURRENT_PATH%..\dependencies\jdk8u265-b01-jre\bin\java + ) else ( + if exist %CURRENT_PATH%..\dependencies\jdk8u202-b08-jre ( + set JAVA_CMD=%CURRENT_PATH%..\dependencies\jdk8u202-b08-jre\bin\java + ) else ( + if not exist "%JAVA_HOME%" ( + echo Compatible JRE not found. Please follow the instructions in ^\INSTALL.txt to install and setup Ballerina. + exit /b + ) + ) ) )