Describe the problem
Since updating to version 0.8.0, hid4java fails to initialize on macOS due to a missing native library libhidapi.dylib.
This was not an issue in version 0.7.0, where everything worked out of the box.
It seems the .dylib is no longer bundled in hid4java-0.8.0.jar, causing failures unless the user manually installs hidapi.
Platform
- Platform 1:
macos-arm64 (Apple Silicon M1/M2), macOS 14 Sonoma
- Platform 2:
macos-x86_64 (Intel i5), macOS 14.7.4 Sonoma
hid4java versions tested:
- ✅
0.7.0 — works correctly
- ❌
0.8.0 — fails to initialize
To Reproduce
Steps:
- Use
hid4java 0.8.0 in a desktop Java app on macOS.
- Run from installed app (e.g.
update4j managed launcher or exported .app)
- Observe error on creating
HidDeviceManager.
Note:
It works when run from the IDE, but fails after user updates their installed app, which suggests the .dylib is no longer included or discoverable in the built output.
Error excerpt
Unable to load library 'hidapi':
dlopen(libhidapi.dylib, 0x0009): tried: 'libhidapi.dylib' (no such file),
'/System/Library/Frameworks/hidapi.framework/hidapi' (no such file, not in dyld cache)...
Native library (darwin/libhidapi.dylib) not found in resource path ([...])
Expected behavior
- Expectation is for
hid4java to behave as in 0.7.0, where the native .dylib is either:
- included in the JAR,
- or loaded from bundled resources,
Additional information
- Installing
hidapi via Homebrew (brew install hidapi) solves the problem — but:
- It only works when launching a new app manually,
- Not ideal or intuitive for non-technical end-users.
Request for help
Would it be possible to:
- Restore the inclusion of
libhidapi.dylib in the default .jar (as in 0.7.0)?
- Or provide guidance on how to bundle it manually inside an app (e.g., load from resources)?
Thanks in advance!
Describe the problem
Since updating to version
0.8.0,hid4javafails to initialize on macOS due to a missing native librarylibhidapi.dylib.This was not an issue in version
0.7.0, where everything worked out of the box.It seems the
.dylibis no longer bundled inhid4java-0.8.0.jar, causing failures unless the user manually installshidapi.Platform
macos-arm64(Apple Silicon M1/M2), macOS 14 Sonomamacos-x86_64(Intel i5), macOS 14.7.4 Sonomahid4javaversions tested:0.7.0— works correctly0.8.0— fails to initializeTo Reproduce
Steps:
hid4java0.8.0 in a desktop Java app on macOS.update4jmanaged launcher or exported.app)HidDeviceManager.Note:
It works when run from the IDE, but fails after user updates their installed app, which suggests the
.dylibis no longer included or discoverable in the built output.Error excerpt
Expected behavior
hid4javato behave as in0.7.0, where the native.dylibis either:Additional information
hidapivia Homebrew (brew install hidapi) solves the problem — but:Request for help
Would it be possible to:
libhidapi.dylibin the default.jar(as in 0.7.0)?Thanks in advance!