javanativefoundation.framework在azul和liberica jdk中没有主要版本——我怎么能告诉java使用它呢?

oaxa6hgo  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(281)

我试图在基于arm的mac上使用本机库,即m1处理器。有几个JVM可用于该体系结构,例如azul或liberica。两个都有一个 JavaNativeFoundation.framework 动态库,这是使用任何jni代码所必需的。然而,该框架没有明确的目标 Versions 包含框架主要版本的文件夹(如 A ). 相反,库仅包含在顶级文件夹中:

/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

试图运行我的程序,我得到

[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

看起来输出不完整,但无论如何:您可以看到java正在尝试从 Versions/A/ 框架的子文件夹,它不存在于任何位置。
如果我创建该子文件夹并创建指向现有二进制文件的软链接 JavaNativeFoundation 然后,应用程序可以很好地加载jni代码。
鉴于这种情况,我有两个问题:
为什么azul/zulu和liberica中的框架都缺少版本结构?
有没有办法通过以不同的方式加载框架来解决这个问题?一些“dontusemajorversion”标志?
谢谢你的帮助。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题