mac m3 pro : Could not initialize class com.sun.jna.Native

java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native

java.lang.UnsatisfiedLinkError: /Users/wang/Library/Caches/JNA/temp/jna2072012754992384454.tmp: dlopen(/Users/wang/Library/Caches/JNA/temp/jna2072012754992384454.tmp, 0x0001): tried: '/Users/wang/Library/Caches/JNA/temp/jna2072012754992384454.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/wang/Library/Caches/JNA/temp/jna2072012754992384454.tmp' (no such file), '/Users/wang/Library/Caches/JNA/temp/jna2072012754992384454.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e' or 'arm64'))
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
    at java.lang.Runtime.load0(Runtime.java:782)
    at java.lang.System.load(System.java:1100)
    at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
    at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
    at com.sun.jna.Native.<clinit>(Native.java:195)

原因是 jna 5.5.0 的版本太低,改为 5.7.0 就可以了。

 

https://github.com/testcontainers/testcontainers-java/issues/3610

https://github.com/oshi/oshi/issues/1462#issuecomment-775523273

 

<dependency>
    <groupId>net.java.dev.jna</groupId>
    <artifactId>jna</artifactId>
    <version>5.7.0</version>
</dependency>

 

posted on 2024-07-02 11:48  快鸟  阅读(118)  评论(0编辑  收藏  举报