There is the The Foreign Function and Memory (FFM) API to Call C Libraries in Java 22.
"This API enables Java programs to call native libraries and process native data without the brittleness and danger of JNI. The API invokes foreign functions, code outside the JVM, and safely accesses foreign memory, memory not managed by the JVM."