<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>thefaux</author><text>I am sort of surprised that there isn&amp;#x27;t a widely used tool that uses codegen to generate jni bindings sort of like what the jna does but at build time. You could go meta and bundle a builder in a jar that looks for the shared library in a particular place and shells out to build and install the native library if it is missing on the host computer. This would run once pretty similar I think to bundling native code in npm.&lt;p&gt;I have bundled shared libraries for five or six platforms in a java library that needs to make syscalls. It works but it is a pain if anything ever changes or a new platform needs to be brought up. Checking in binaries always feels icky but is necessary if not all targets can be built on a single machine.&lt;p&gt;The problem with the new api is that people upgrade java very slowly in most contexts. For an oss library developer, I see very little value add in this feature because I&amp;#x27;m still stuck for all of my users who are using an older version of java. If I integrate the new ffi api, now I have to support both it and the jni api.</text><parent_chain></parent_chain></comment><story><title>How to Use the Foreign Function API in Java 22 to Call C Libraries</title><url>https://ifesunmola.com/how-to-use-the-foreign-function-api-in-java-22-to-call-c-libraries/</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>marginalia_nu</author><text>What I&amp;#x27;m missing is a model for building&amp;#x2F;distributing those C libraries with a java application.&lt;p&gt;Every ffi example I&amp;#x27;ve found seem to operate on the assumption that you want to invoke syscalls or libc, which (with possibly the exception of like madvise and aioring) Java already mostly has decent facilities to interact with even without native calls.</text><parent_chain></parent_chain></comment><story><title>How to Use the Foreign Function API in Java 22 to Call C Libraries</title><url>https://ifesunmola.com/how-to-use-the-foreign-function-api-in-java-22-to-call-c-libraries/</url></story>