I guess Java was selected due to its popularity and ease of use in a multiplatform environment.
Unfortunately Java - or JVM in general has the problem that the native optimizations happen during the runtime - once optimized code gets re-optimized or sometimes de-optimized many times - that costs a lot of CPU nad results in inconsistent performance. It is also very hard to predict wnen such re-optimizations will happen so CPU load management in a realtime system is pretty much impossible with JVM... note, this is more or less problem with any JIT based platform, however other platforms like i.e. dotnet core give developers access to low level CPU features which drastically reduce the cost of re-optimizations - In dotnet the Just In Time compiler has a lot less work to do. JVM is stil in the stone age from this point of view...
C++ would obviously be best solution but it is hard for beginners. But there are many other native technologies which are a lot more dev friendly and still produce stable performance.
And again, building native modules for Mac usually requires some bits from the XCode which is Mac only - not a blocker but a bit painful to set an OsX toolchain on other platforms - not for beginners...
Rust or Kotlin Native with an online build service could be a way... Enabling native support for C/C++ would pretty much automatically allow those technologies to be used as well.
Lots of ways to do that.. each has good and bad sides...