1 Reply Latest reply on Oct 17, 2010 8:32 AM by Opal

    javax usb exception

      Hi All - I'm kinda new at this and looking for some help. I successfully compiled the program below to enumerate the USB bus, but when I run the program I get the errors (listed at the end). Where did I go wrong? Any help would much appreciated. Thank you


      import javax.usb.*;
      import java.util.List;

      public class TraverseUSB {
      public static void main(String argv[]) {
      try {
      // Access the system USB services, and access to the root
      // hub. Then traverse through the root hub.
      UsbServices services = UsbHostManager.getUsbServices();
      UsbHub rootHub = services.getRootUsbHub();
      } catch (Exception e) {}

      public static void traverse(UsbDevice device) {
      if (device.isUsbHub()) {
      // This is a USB Hub, traverse through the hub.
      List attachedDevices =
      ((UsbHub) device).getAttachedUsbDevices();
      for (int i=0; i<attachedDevices.size(); i++) {
      traverse((UsbDevice) attachedDevices.get(i));
      else {
      // This is a USB function, not a hub.
      // Do something.


      # java TraverseUSB
      Exception in thread "main" java.lang.NoClassDefFoundError: javax/usb/UsbDevice
      Caused by: java.lang.ClassNotFoundException: javax.usb.UsbDevice
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
      Could not find the main class: TraverseUSB. Program will exit.