Loader.class.getResource() returns null on another computer

135 Views Asked by At

I am working on a programm which reads the data from a barcodescanner. To connect with the scanner, i use usb4java which works great.

After i finished my programm i wanted to test in on another computer. The result is a LoaderException from usb4java "Native library not found in classpath: /org/usb4java/windows-x86_64/libusb-1.0.dll".

I have searched on google and stackoverflow and found different a lot of answers about MANIFEST.MF, getResource() and getResourceAsStream() but nothing helped. It never worked on the other computer. So i looked in the class from usb4java which throws the exception line 277: https://github.com/usb4java/usb4java/blob/master/src/main/java/org/usb4java/Loader.java So i thought i just add following line to my program code:

System.out.println(Loader.class.getResource("/org/usb4java/windows-x86_64/libusb-1.0.dll"));

The result on my computer shows the directory is found:

jar:file:/C:/Users/somename/Desktop/scanner/BarcodeScanner.jar!/org/usb/windows-x86_64/libusb-1.0.dll

The result on the other computer is just:

null

This indicates the problem is not in the program code.

I searched a lot of hours but I am not able to find out the problem.

Here a screenshot of the exception: LoaderException

Edit: I forgot to mention the jar-files: here is a picture from my project in eclipse: enter image description here

Edit2: unzipped jar file

content of MANIFEST.MF from directory META-INF: MANIFEST.MF

0

There are 0 best solutions below