Exception in thread "main" java.lang.UnsatisfiedLinkError: no jusb in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at usb.windows.Windows.getHost(Windows.java:93)
at usb.windows.Windows.createHost(Windows.java:79)
at usb.core.HostFactory.maybeGetHost(HostFactory.java:98)
at usb.core.HostFactory.getHost(HostFactory.java:80)
at ListUSB.main(ListUSB.java:10)
工程是有引用了juse包的.
不知道怎么解决,请大家帮忙看看。

解决方案 »

  1.   

    自己顶下,在贴下程序
    import java.io.InputStream;
    import java.io.OutputStream;import usb.core.*;public class ListUSB {
    public static void main(String[] args) {
    try {
    // Bootstrap by getting the USB Host from the HostFactory.
    Host host = HostFactory.getHost(); // Obtain a list of the USB buses available on the Host.
    Bus[] bus = host.getBusses();
    int total_bus = bus.length; // Traverse through all the USB buses.
    for (int i = 0; i < total_bus; i++) {
    // Access the root hub on the USB bus and obtain the
    // number of USB ports available on the root hub.
    Device root = bus[i].getRootHub();
    int total_port = root.getNumPorts(); // Traverse through all the USB ports available on the
    // root hub. It should be mentioned that the numbering
    // starts from 1, not 0.
    for (int j = 1; j <= total_port; j++) {
    // Obtain the Device connected to the port.
    Device device = root.getChild(j);
    if (device != null) {
    // Obtain the current Configuration of the device and
    // the number of
    // Interfaces available under the current Configuration.
    Configuration config = device.getConfiguration();
    int total_interface = config.getNumInterfaces(); // Traverse through the Interfaces
    for (int k = 0; k < total_interface; k++) {
    // Access the currently Interface and obtain the
    // number of
    // endpoints available on the Interface.
    Interface itf = config.getInterface(k, 0);
    int total_ep = itf.getNumEndpoints(); // Traverse through all the endpoints.
    for (int l = 0; l < total_ep; l++) {
    // Access the endpoint, and obtain its I/O type.
    Endpoint ep = itf.getEndpoint(l);
    String io_type = ep.getType();
    boolean input = ep.isInput(); // If the endpoint is an input endpoint, obtain
    // its
    // InputStream and read in data.
    if (input) {
    InputStream in;
    in = ep.getInputStream();

    // Read in data here
    in.close();
    }
    // If the Endpoint is and output Endpoint,
    // obtain its
    // OutputStream and write out data.
    else {
    OutputStream out;
    out = ep.getOutputStream();
    // Write out data here.

    out.close();
    }
    }
    }
    }
    }
    }
    } catch (Exception e) {
    System.out.println(e.getMessage());
    }
    }
    }
      

  2.   

    老兄,你引用的juse包肯定调用了某些dll文件。
    把那些文件所在目录加入path下就行了。