Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gmseed opened this issue Oct 11, 2023 · 0 comments
Open

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

gmseed opened this issue Oct 11, 2023 · 0 comments

Comments

@gmseed
Copy link

gmseed commented Oct 11, 2023

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."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant