From 9f7f30a1661139b23b2a629e6163f089c6a450c6 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 13 Sep 2018 14:50:15 +0200 Subject: [PATCH] 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 --- Tools/jmavsim_run.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tools/jmavsim_run.sh b/Tools/jmavsim_run.sh index c158fd373f..3e37b8e71a 100755 --- a/Tools/jmavsim_run.sh +++ b/Tools/jmavsim_run.sh @@ -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