'How do you get Java Spring Boot to run on an M1 mac when it requires libzstd-jni.dylib?

On my Apple M1 laptop I'm trying to run spring boot, but I get the error:

java.lang.UnsatisfiedLinkError: no zstd-jni in java.library.path: /Users/me/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Unsupported OS/arch, cannot find /darwin/aarch64/libzstd-jni.dylib or load zstd-jni from system libraries. Please try building from source the jar or providing libzstd-jni in your system.

Being on a mac I don't have /darwin/aarch64/ folder and I can't find where to install or download libzstd-jni.dylib.

I installed Java through the Arm 64 DMG Installer

$ java -version 

- java version "17.0.2" 2022-01-18 LTS
- Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
- Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)

There is a libjli.dylib file in the MasOS folder in JDK: /Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/MacOS/libjli.dylib

I added libjli.dylib to /Library/Java/Extensions/, but that didn't help.

I'm out of options. If anyone can help me I would be super appreciative.



Solution 1:[1]

This is the official repository: https://github.com/luben/zstd-jni

In binary releases I see support for aarch64. I would try to bump to the latest version:

implementation 'com.github.luben:zstd-jni:1.5.2-1'

(I don't have this kind of problem, it's just a guess -- let me know if it helps.)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mrek