我从适用于 Windows 的代码中获得了一个 .jar 文件,我正尝试在 Linux 上运行它,但我一直收到此消息,但不知道该怎么做。
Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: no usbJava in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1856)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at ch.ntb.usb.LibusbJava.<clinit>(LibusbJava.java:366)
at ch.ntb.usb.USB.init(USB.java:315)
at ch.ntb.usb.USB.getBus(USB.java:296)
at ch.ntb.usb.Device.initDevice(Device.java:102)
at ch.ntb.usb.Device.open(Device.java:222)
at TransmitterModuleHIDInterface.run(TransmitterModuleHIDInterface.java:28)
at java.lang.Thread.run(Thread.java:722)
我正在使用 libusb-0.1 的 Java 包装器(我遵循了安装说明 here)。
非常感谢任何帮助!
最佳答案
您需要根据 Linux 安装说明创建共享库的链接:
http://libusbjava.sourceforge.net/wp/?page_id=8
如果您在构建共享库时遇到问题,这可能会有所帮助:
http://me.opengroove.org/2010/01/libusbjavaso.html
库本身的源代码位于 SVN 源代码树中的/libusbjava/trunk/LibusbJava/下。
关于java - java.library.path 中没有 usbJava,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16683207/