diff --git a/build.xml b/build.xml index 99fce9c6b..eeef9ad28 100644 --- a/build.xml +++ b/build.xml @@ -424,6 +424,7 @@ osname=macosx;processor=aarch64 + @@ -433,6 +434,7 @@ osname=macosx;processor=aarch64 Java Native Access (JNA)

Table of Contents

  • Loading JNA +
  • Library Mapping
  • Function Mapping
  • Type Mapping @@ -81,6 +84,53 @@

    Loading JNA

    library (e.g. for different architectures) in the same directory.

    +Top + +

    Special considerations for JDK24+

    +The JDK moves to "safe by default" or "Integrity by Default" settings. Settings +that might compromise the integrity provided by the JVM are off by default. +Since JDK 24 this also affects the usage of Java Native Interface (JNI). This +is part of the foundation JNA is built upon. For JDK 24 this is a warning, in +the future JNI will be restricted to explicitly enabled modules. +

    +To fix the warnings and prepare for the future, the applications using JNA need +to be modified. The java launcher will need to be instructed to allow JNI for +the module JNA was loaded from. In the most basic case JNA is loaded from the +classpath. For example, the built in mini-check of JNA can be invoked as: + +

    +java -jar jna.jar
    +
    + +This will need to be modified to: + +
    +java --enable-native-access=ALL-UNNAMED -jar jna.jar
    +
    + +If JNA is loaded from the modulepath + +
    +java -p jna-jpms.jar -m com.sun.jna
    +
    + +That will need to be modified to: + +
    +java --enable-native-access=com.sun.jna -p jna-jpms.jar -m com.sun.jna
    +
    + +For executable JARs the manifest attribute Enable-Native-Access can +be set to the value ALL-UNNAMED to enable native access for this +case. +

    +How these changes are applied to the concrete project is highly dependending on +the setup of that project and thus no general advise can be presented here. +

    +More information can be found on the page describing JEP 472: Prepare to Restrict +the Use of JNI +

    Top

    Library Mapping