jni-sys
Rust definitions corresponding to jni.h
0.4.1
157M downloads/mo
#595 most downloaded on crates.io
jni-rs/jni-sys
What this package is like to depend on
Last release 5 months ago
22 Mar 2026
Ships unpredictably
gaps range from 4 weeks to 6.2 years
Nearly every release is documented
notes for 9 of 10 stable releases
1 version withdrawn
withdrawn after publishing
10 years old
11 releases · first in 2016
2 releases in the last 12 months
see the full history below
Release timeline
11 releases · Feb 2016 to Mar 2026Releases
latest 11-
0.4.109 Jan 2026Release notes
Open source →What's Changed
- Update to syn 2.0 by @rukai in #36
- Update Readme by @atouchet in #39
- Use SPDX license format by @atouchet in #40
- Add GetStringUTFLengthAsLong by @r3bb1t in #42
- Bump rust-version to 1.76 for trybuild dev dependency by @rib in #44
- Fix jni_env_union test by @rib in #45
- Systest build fix for darwin/linux by @rib in #46
- Add JNI_VERSION_24 by @rib in #47
- Release jni-sys-macros 0.4.1 by @rib in #48
- Release 0.4.1 by @rib in #37
New Contributors
- @rukai made their first contribution in #36
- @atouchet made their first contribution in #39
- @r3bb1t made their first contribution in #42
Full Changelog: v0.4.0...v0.4.1
Release notes
Open source → -
0.4.025 Sep 2023Release notes
Open source →It's alive! 😃
It's been about 6 years since the last release and although that's generally been OK, since the JNI API doesn't change that frequently, there have been a number of paper cuts adding up that this release hopefully helps to address.
Thanks to @sfackler for transferring the repo to the https://github.com/jni-rs Github organisation where we can hopefully keep the flame alive.
The most notable changes are that
jbooleanis now an alias forbooland thatJNINativeInterface_is now a union that namespaces the functions based on the JNI version when each function was added to the spec. Please see below for more details.Added
- Added
JNI_VERSION_9,JNI_VERSION_10,JNI_VERSION_19,JNI_VERSION_20andJNI_VERSION_21constants - Added
GetModule()toJNINativeInterface(#22) IsVirtualThread()toJNINativeInterface(#32)- Implemented
Debugtrait for all types (#31) - Added support for
no_stdenvironments (#12)
Changed
-
jbooleanis now an alias forboolinstead ofu8(#23) -
The
JNIInvokeInterface_andJNINativeInterface_structs were turned into unions that namespace functions by version (#28):This makes it much clearer what version of JNI you require to access any function safely.
So instead of a struct like:
struct JNINativeInterface_ { pub reserved0: *mut c_void, .. pub GetVersion: unsafe extern "system" fn(env: *mut JNIEnv) -> jint, .. pub NewLocalRef: unsafe extern "system" fn(env: *mut JNIEnv, ref_: jobject) -> jobject, }
there is now a union like:
union JNINativeInterface_ { v1_1: JNINativeInterface__1_1, v1_2: JNINativeInterface__1_2, reserved: JNINativeInterface__reserved, }
And you can access
GetVersionlike:env.v1_1.GetVersionand accessNewLocalReflike:env.v1_2.NewLocalRef.Each version struct includes all functions for that version and lower, so it's also possible to access
GetVersionlikeenv.v1_2.GetVersion. -
Function pointers are no longer wrapped in an
Option<>(#25)
New Contributors
- @marschall made their first contribution in #9
- @CertainLach made their first contribution in #12
- @morristai made their first contribution in #15
Full Changelog: v0.3.0...v0.4.0
Release notes
Open source →Added
- Added
JNI_VERSION_9,JNI_VERSION_10,JNI_VERSION_19,JNI_VERSION_20andJNI_VERSION_21constants - Added
GetModule()toJNINativeInterface(#22) IsVirtualThread()toJNINativeInterface(#32)- Implemented
Debugtrait for all types (#31) - Added support for
no_stdenvironments (#12)
Changed
-
jbooleanis now an alias forboolinstead ofu8(#23) -
The
JNIInvokeInterface_andJNINativeInterface_structs were turned into unions that namespace functions by version (#28):This makes it much clearer what version of JNI you require to access any function safely.
So instead of a struct like:
struct JNINativeInterface_ { pub reserved0: *mut c_void, .. pub GetVersion: unsafe extern "system" fn(env: *mut JNIEnv) -> jint, .. pub NewLocalRef: unsafe extern "system" fn(env: *mut JNIEnv, ref_: jobject) -> jobject, }there is now a union like:
union JNINativeInterface_ { v1_1: JNINativeInterface__1_1, v1_2: JNINativeInterface__1_2, reserved: JNINativeInterface__reserved, }And you can access
GetVersionlike:env.v1_1.GetVersionand accessNewLocalReflike:env.v1_2.NewLocalRef.Each version struct includes all functions for that version and lower, so it's also possible to access
GetVersionlikeenv.v1_2.GetVersion. -
Function pointers are no longer wrapped in an
Option<>(#25)
- Added
-
0.3.122 Mar 2026Release notes
Open source →This release applies the semver trick to re-export compatible types from
jni-sys 0.4(namelyjobject) to make it easier forjobjectreferences to be passed around between APIs depending on different versions ofjni-sysThe MSRV was bumped to 1.77
What's Changed
Added
- GetModule was added to
JNINativeInterface(#22) JNI_VERSION_{9,10,19,20,21,24}version definitions were added
Changed
- Compatible types are now re-exported from
jni-sys 0.4to make it easier forjobjectreferences
to be passed around between APIs depending on different versions ofjni-sys
Full Changelog: v0.3.0...v0.3.1
- GetModule was added to
-
0.3.021 Jul 2017Release notes
Open source →jvalueis now properly a union.Defaultimpls have been removed from structs.
-
0.2.523 Jun 2017 -
0.2.423 Jun 2017 -
0.2.321 Jun 2017 -
0.2.202 Jan 2017 -
0.2.129 Nov 2016 -
0.2.029 Nov 2016 withdrawnNothing published for this version
-
0.1.026 Feb 2016Nothing published for this version