Problem running jMAVSim on MacOS High Sierra

Thanks. I’ve tried installing java8 using these instructions, but I still see version 9.0.1, and it still fails.

This is too painful.

I think I’m going to switch to using a Ubuntu VM. The Ardupilot process seems to work.

You can run more than one version of Java on MacOS. So you can just set the version of your terminal with this command in MacOS.

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

I was able to run jMAVSim after doing this.

Hmm. After running that I get:

iMac:Firmware alan$ java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

If I then run make posix jmavsim I get:

Exception in thread “main” java.lang.UnsupportedClassVersionError: me/drton/jmavsim/Simulator has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Try java -version

For this error, you have to recompile everything with the current java version and then run.

Thanks very much. I wasn’t sure how to recompile everything, so I deleted it all and started again. I then had several issues with bits of missing software, but eventually I was able to get it going.

“commander takeoff” caused the simulated vehicle to lift off, then go into “failsafe enabled: no datalink”. RTL took it straight back down again. I had to start up QGroundControl to give it a datalink!

Anyway, it looks as if I finally have a working toolchain. Thanks again.

I got it to work!

I did remove Java9, installed Java8 using brew cask just as AlanH linked to.
I ran a make clean command and then the make posix jmavsim

It al started!

Thnx a lot

Using JDK 8 and 9 in parallel on OSX. I switch to JDK 8 within Tools/jmavsim_run.sh just before calling ant:

...
if [ "$device" == "" ]; then
	device="-udp $ip:$udp_port"
else
	device="-serial $device $baudrate"
fi

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

ant create_run_jar copy_res
cd out/production
...

A bit of a workaround, but it works for me…

Exactly same question…

and now the java version is 10

that fixed the problem - thanks! I had Java 10 installed previously, downgrading to 8 made it work!

Tracked in https://github.com/PX4/Firmware/issues/10443.

1 Like