java.lang.UnsatisfiedLinkError开始播放项目时

java.lang.UnsatisfiedLinkError when starting the play project

我试图在 M1 上的 IntelliJ IDEA Ultimate MacBook Pro 中开始播放项目,我在控制台中收到以下错误:

[error] java.lang.UnsatisfiedLinkError: /Users/username/Library/Caches/JNA/temp/jna2878211531869408345.tmp: dlopen(/Users/username/Library/Caches/JNA/temp/jna2878211531869408345.tmp, 0x0001): tried: '/Users/username/Library/Caches/JNA/temp/jna2878211531869408345.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna2878211531869408345.tmp' (no such file)

删除所有 JDK 后,我尝试在 arm 架构上重新安装 JDK,但没有帮助

需要用什么技巧来解决这个问题?

完整的 StackTrace:

[error] java.lang.UnsatisfiedLinkError: /Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp: dlopen(/Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp, 0x0001): tried: '/Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna2878211531869408345.tmp' (no such file)
    [error]     at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
    [error]     at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
    [error]     at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
    [error]     at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
    [error]     at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
    [error]     at java.base/java.lang.Runtime.load0(Runtime.java:768)
    [error]     at java.base/java.lang.System.load(System.java:1837)
    [error]     at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
    [error]     at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
    [error]     at com.sun.jna.Native.<clinit>(Native.java:195)
    [error]     at io.methvin.watchservice.jna.CarbonAPI.<clinit>(CarbonAPI.java:19)
    [error]     at io.methvin.watchservice.jna.CFStringRef.toCFString(CFStringRef.java:23)
    [error]     at io.methvin.watchservice.MacOSXListeningWatchService.register(MacOSXListeningWatchService.java:101)
    [error]     at io.methvin.watchservice.WatchablePath.register(WatchablePath.java:50)
    [error]     at io.methvin.watcher.DirectoryWatcher.register(DirectoryWatcher.java:352)
    [error]     at io.methvin.watcher.DirectoryWatcher.registerAll(DirectoryWatcher.java:317)
    [error]     at io.methvin.watcher.DirectoryWatcher.<init>(DirectoryWatcher.java:167)
    [error]     at io.methvin.watcher.DirectoryWatcher$Builder.build(DirectoryWatcher.java:118)
    [error]     at play.dev.filewatch.DefaultFileWatchService.watch(DefaultFileWatchService.scala:38)
    [error]     at play.dev.filewatch.FileWatchService$$anon.watch(FileWatchService.scala:87)
    [error]     at play.runsupport.Reloader.<init>(Reloader.scala:414)
    [error]     at play.runsupport.Reloader$.reloader$lzycompute(Reloader.scala:259)
    [error]     at play.runsupport.Reloader$.play$runsupport$Reloader$$reloader(Reloader.scala:251)
    [error]     at play.runsupport.Reloader$.startDevMode(Reloader.scala:271)
    [error]     at play.sbt.run.PlayRun$.devModeServer$lzycompute(PlayRun.scala:99)
    [error]     at play.sbt.run.PlayRun$.devModeServer(PlayRun.scala:83)
    [error]     at play.sbt.run.PlayRun$.$anonfun$playRunTask(PlayRun.scala:106)
    [error]     at play.sbt.run.PlayRun$.$anonfun$playRunTask$adapted(PlayRun.scala:68)
    [error]     at scala.Function1.$anonfun$compose(Function1.scala:49)
    [error] stack trace is suppressed; run 'last Compile / run' for the full output
    [error] (Compile / run) java.lang.UnsatisfiedLinkError: /Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp: dlopen(/Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp, 0x0001): tried: '/Users/romangoltsov/Library/Caches/JNA/temp/jna2878211531869408345.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna2878211531869408345.tmp' (no such file)

找到解决办法: 在 sbt 1.4.6 中有一个 JNA 库版本 5.5.0,它显然没有 arm64 架构处理器所需的文件 将 sbt 版本提高到 1.6.2 有帮助