jmavsim_run.sh: fall back to Java 9 on macOS

This checks if we are on macOS and if we have Java 8 installed. If yes,
it falls back to Java 8 by setting JAVA_HOME.

This avoids https://github.com/PX4/jMAVSim/issues/81
This commit is contained in:
Julian Oes 2018-09-13 14:50:15 +02:00 committed by Daniel Agar
parent fec3422f54
commit 9f7f30a166
1 changed files with 12 additions and 0 deletions

View File

@ -43,6 +43,18 @@ else
device="-serial $device $baudrate"
fi
# jMAVSim crashes with Java 9 on macOS, therefore we need to use Java 8
if [ "$(uname)" == "Darwin" ]; then
bold=$(tput bold)
normal=$(tput sgr0)
if ! /usr/libexec/java_home -V 2>&1 | grep --quiet "Java SE 8" ; then
echo "${bold}You need to have Java 8 installed for macOS, for more info, see:${normal}"
echo "${bold}https://github.com/PX4/jMAVSim/issues/81${normal}"
exit 1
fi
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
fi
ant create_run_jar copy_res
cd out/production