title: JavaNativeFoundation.framework comes without major version in Azul and Liberica JDK – how can I tell Java to use it anyway?
body: <p>I am trying to use a native library on an ARM based Mac, i.e. an M1 processor. There are several JVMs available for that architecture, for example Azul or Liberica. Both come with a <code>JavaNativeFoundation.framework</code> dynamic library, which is necessary to use any JNI code. However, the framework does not have a <code>Versions</code> folder that contains the major version of the framework (like <code>A</code>). Instead, the library is just contained in the top level folder:</p>
  <pre><code>/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/lib/JavaNativeFoundation.framework
  /Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/lib/JavaNativeFoundation.framework/_CodeSignature
  /Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/lib/JavaNativeFoundation.framework/_CodeSignature/CodeResources
  /Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/lib/JavaNativeFoundation.framework/JavaNativeFoundation
  /Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/lib/JavaNativeFoundation.framework/Resources
  /Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/lib/JavaNativeFoundation.framework/Resources/Info.plist
  </code></pre>
  <p>Trying to run my program I get</p>
  <pre><code>[java] AquaNativeSupport: Unable to load library libvaqua.dylib: /private/var/folders/tg/06858t0j3w10js_5hb3k5frw0000gn/T/libvaqua4883847212092667097.dylib: dlopen(/private/var/folders/tg/06858t0j3w10js_5hb3k5frw0000gn/T/libvaqua4883847212092667097.dylib, 0x0001): Library not loaded: @rpath/JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation
  [java]   Referenced from: /private/var/folders/tg/06858t0j3w10js_5hb3k5frw0000gn/T/libvaqua4883847212092667097.dylib
  [java]   Reason: tried: '/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/lib/server/./JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation' (no such file),
   '/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/lib/server/../JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation' (no such file),
   '/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/bin/./JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation' (no such file),
   '/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home/bin/../lib/JavaNativeFoundation.framework/Versions/A/Java
  </code></pre>
  <p>It looks like the output is incomplete, but anyway: You can see that java is trying to load the framework from a <code>Versions/A/</code> subfolder of the framework, which does not exist anywhere.</p>
  <p>If I create that subfolder and create a softlink to the existing binary <code>JavaNativeFoundation</code> in it, then the application loads the JNI code just fine.</p>
  <p>Given that situation I have two questions:</p>
  <ol>
  <li>Why are the Frameworks in both Azul/zulu and Liberica missing the Versions structure?</li>
  <li>Is there a way to work around that problem by loading the Framework in a different way? Some &quot;dontusemajorversion&quot; flag?</li>
  </ol>
  <p>Thank you for your help.</p>