PackageTrack
Sign in Get early access

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 2026
2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release Withdrawn

Releases

latest 11
  1. 0.4.1 09 Jan 2026
    Release notes

    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

    Full Changelog: v0.4.0...v0.4.1

    Open source →
    Release notes

    Added

    • Added JNI_VERSION_24 constant (#47)
    • Added GetStringUTFLengthAsLong to JNINativeInterface (#42)

    Changed

    • Bumped syn crate dependency to 2 (for jni-sys-macros) (#36)
    Open source →
  2. 0.4.0 25 Sep 2023
    Release notes

    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 jboolean is now an alias for bool and that JNINativeInterface_ 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_20 and JNI_VERSION_21 constants
    • Added GetModule() to JNINativeInterface (#22)
    • IsVirtualThread() to JNINativeInterface (#32)
    • Implemented Debug trait for all types (#31)
    • Added support for no_std environments (#12)

    Changed

    • jboolean is now an alias for bool instead of u8 (#23)

    • The JNIInvokeInterface_ and JNINativeInterface_ 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 GetVersion like: env.v1_1.GetVersion and access NewLocalRef like: env.v1_2.NewLocalRef.

      Each version struct includes all functions for that version and lower, so it's also possible to access GetVersion like env.v1_2.GetVersion.

    • Function pointers are no longer wrapped in an Option<> (#25)

    New Contributors

    Full Changelog: v0.3.0...v0.4.0

    Open source →
    Release notes

    Added

    • Added JNI_VERSION_9, JNI_VERSION_10, JNI_VERSION_19, JNI_VERSION_20 and JNI_VERSION_21 constants
    • Added GetModule() to JNINativeInterface (#22)
    • IsVirtualThread() to JNINativeInterface (#32)
    • Implemented Debug trait for all types (#31)
    • Added support for no_std environments (#12)

    Changed

    • jboolean is now an alias for bool instead of u8 (#23)

    • The JNIInvokeInterface_ and JNINativeInterface_ 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 GetVersion like: env.v1_1.GetVersion and access NewLocalRef like: env.v1_2.NewLocalRef.

      Each version struct includes all functions for that version and lower, so it's also possible to access GetVersion like env.v1_2.GetVersion.

    • Function pointers are no longer wrapped in an Option<> (#25)

    Open source →
  3. 0.3.1 22 Mar 2026
    Release notes

    This release applies the semver trick to re-export compatible types from jni-sys 0.4 (namely jobject) to make it easier for jobject references to be passed around between APIs depending on different versions of jni-sys

    The 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.4 to make it easier for jobject references
      to be passed around between APIs depending on different versions of jni-sys

    Full Changelog: v0.3.0...v0.3.1

    Open source →
  4. 0.3.0 21 Jul 2017
    Release notes
    • jvalue is now properly a union.
    • Default impls have been removed from structs.
    Open source →
    Release notes

    Changed

    • Changed jvalue into a union
    Open source →
  5. 0.2.5 23 Jun 2017
    Release notes
    • Make jvalue's field public again to fix back compat break.
    Open source →
  6. 0.2.4 23 Jun 2017
    Release notes
    • Add JNI_GetDefaultJavaVMInitArgs and JNI_GetCreatedJavaVMs.
    Open source →
  7. 0.2.3 21 Jun 2017
    Release notes
    • Fix calling convention on 32 bit Windows.
    Open source →
  8. 0.2.2 02 Jan 2017
    Release notes
    • Add JNI_CreateJavaVM
    Open source →
  9. 0.2.1 29 Nov 2016
    Release notes
    • Fix regression in FatalError signature
    Open source →
  10. 0.2.0 29 Nov 2016 withdrawn

    Nothing published for this version

  11. 0.1.0 26 Feb 2016

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive