Loading /org/usb4java/win32-x86-64/libusb4java.dll in Eclipse · Issue #88 · usb4java/usb4java · GitHub
Skip to content

Loading /org/usb4java/win32-x86-64/libusb4java.dll in Eclipse #88

Description

@gmseed

On the usb4java website under Native Libs it states:

"usb4java only extracts the files into a temporary directory when they are inside a JAR file."

but what exactly does this mean?

Does it mean that if I generate my own libusb4java-1.3.0-win32-x86-64.jar and don't put another inside it then useb4java will not load the embedded dll?

I've not had a problem using the libusb4java wrappers with Java8 but with J21 when using modules it is problematic since usb4java is non-modular. I have an app that runs fine in cmdline but when run in Eclipse fails with the stracktrace:

Exception in thread "main" java.lang.ExceptionInInitializerError
...
Caused by: org.usb4java.LoaderException: Native library not found in classpath: /org/usb4java/win32-x86-64/libusb4java.dll
at usb4java@1.3.0/org.usb4java.Loader.extractLibrary(Loader.java:246)
at usb4java@1.3.0/org.usb4java.Loader.load(Loader.java:323)
at usb4java@1.3.0/org.usb4java.LibUsb.(LibUsb.java:690)
... 6 more

I can't see how to resolve this if I want to use the native libs directly because we have to call LibUsb.init() - the library demands it. But in doing so it ends up in Loader.load() and then Loader.extractLibrary() where the LoaderException is thrown because it can't resolve the path.

So, how does one realise this statement without a switch for bypassing this attempt to load a native?:

"usb4java only extracts the files into a temporary directory when they are inside a JAR file."

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions