Nowadays there's a much better technology than JNI for doing this sort of thing in Java.
https://docs.oracle.com/en/graalvm/jdk/21/docs/reference-man...
https://docs.oracle.com/en/graalvm/jdk/21/docs/reference-man...
Still GraalVM could be an interesting solution as Rust seems to be supported: https://www.graalvm.org/latest/reference-manual/llvm/Compili...
https://github.com/oracle/graal/blob/master/substratevm/src/...
And in any case:
JEP draft: Prepare to Restrict The Use of JNI https://openjdk.org/jeps/8307341
JEP 442: Foreign Function & Memory API (Third Preview) https://openjdk.org/jeps/442