Java has a new FFI API https://openjdk.java.net/jeps/419 which has different performance characteristics. Using jdk 18 (stable) would be fair too. Also for Java c++ interop, the best library is https://github.com/bytedeco/javacpp