Skip to content

Unable to load library hidapi #167

Description

@OleksiiHromovych

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:

  1. Use hid4java 0.8.0 in a desktop Java app on macOS.
  2. Run from installed app (e.g. update4j managed launcher or exported .app)
  3. 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:

  1. Restore the inclusion of libhidapi.dylib in the default .jar (as in 0.7.0)?
  2. Or provide guidance on how to bundle it manually inside an app (e.g., load from resources)?

Thanks in advance!


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions