Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Java Native Interface
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Alternatives == Microsoft's proprietary implementation of a Java Virtual Machine ([[Visual J++]]) had a similar mechanism for calling native code from Java, called the ''Raw Native Interface'' (''RNI''). In addition, it had an easy way to call existing native code that was not itself aware of Java, such as (but not limited to) the Windows API, called ''J/Direct''. However, following the [[Visual J++#Litigation against J++|Sun–Microsoft litigation]] about this implementation, [[Visual J++]] is no longer maintained. RNI was less clumsy to use than JNI, because no bookkeeping with a Java environment pointer was needed. Instead, all Java objects could be accessed directly. To facilitate this, a tool was used to generate header files from Java classes. Similarly, J/Direct was easier to use than using the necessary intermediate native library and JNI. [[Java Native Access|Java Native Access (JNA)]] is a community-developed library that provides Java programmers easy access to native shared libraries without using JNI. However, this requires the redistribution of the dependent jar library. The tradeoff is between JNI being harder to code and JNA being slower.<ref>{{cite web |last1=Zakusylo |first1=Alexander |title=Github is also the original JNA source. JNA vs JNI benchmark speed tests |url=https://github.com/zakgof/java-native-benchmark |website=Github |publisher=Github |access-date=30 March 2023}}</ref> JNI is built in to core Java. Since Java 22, the newer Foreign Function and Memory API is encouraged for use over JNI, due to the reduced boilerplate and simplified interface.<ref>{{cite web|url= https://openjdk.org/jeps/454|title= JEP 454: Foreign Function & Memory API|date=7 April 2025|publisher=OpenJDK}}</ref> It is located in package {{Javadoc:SE|package=java.lang.foreign|java/lang/foreign}}.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)