Java errors running JMAVSim

When I run “make PX4_sitl jmavsim” I get the simulation to run but I also get these errors…

My java version is…“java -version”…

java version “17.0.1” 2021-10-19 LTS
Java™ SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot™ 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

Total time: 0 seconds
Options parsed, starting Sim.
Starting GUI…

Caught AppContextInfo(Bug 1004) InaccessibleObjectException: Unable to make public static sun.awt.AppContext sun.awt.AppContext.getAppContext() accessible: module java.desktop does not “exports sun.awt” to unnamed module @6166e06f on thread J3D-Renderer-1

1 Like

Have you tried with an older Java version?

1 Like

I asked about this in Slack and was able to suppress the error with a fix suggested by a gentleman named Thomas Debrunner. His response to my post is pasted below.

These errors come from internal APIs that are no longer exposed on newer java versions. You can silence them by replacing the java command on line 65 in with java --add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.desktop/sun.awt=ALL-UNNAMED --add-exports java.desktop/sun.java2d=ALL-UNNAMED -XX:GCTimeRatio=20 -Djava.ext.dirs= -jar jmavsim_run.jar $device $extra_args

1 Like