Javax.usb

Hello
I'm planning to write an application to connect to a development board via USB connection.
After google-ing i ended up trying to install javax-usb.
Downloaded the 3 packages:
     javax-usb_1.0.2
javax-usb-ri_1.0.2
     javax-usb-ri-linux_1.0.2
javax-usb builds ok. I add the path to "/lib/jsr80.jar" to my CLASSPATH.
when I try to build the second one, javax-usb-ri_1.0.2, I get lots of errors:
clean:
[echo] Cleaning everything.
compile:
[echo] Compiling class files.
[javac] Compiling 50 source files to /home/iggy/Documents/javax-usb-ri/src
[javac] /home/iggy/Documents/javax-usb-ri/src/com/ibm/jusb/DefaultUsbInterfacePolicy.java:12: package javax.usb does not exist
[javac] import javax.usb.*;
[javac] ^
[javac] /home/iggy/Documents/javax-usb-ri/src/com/ibm/jusb/DefaultUsbInterfacePolicy.java:18: cannot find symbol
[javac] symbol: class UsbInterfacePolicy
[javac] public class DefaultUsbInterfacePolicy implements UsbInterfacePolicy
[javac] ^
[javac] /home/iggy/Documents/javax-usb-ri/src/com/ibm/jusb/DefaultUsbInterfacePolicy.java:37: cannot find symbol
[javac] symbol : class UsbInterface
[javac] location: class com.ibm.jusb.DefaultUsbInterfacePolicy
[javac]      public boolean forceClaim(UsbInterface usbInterface) { return false; }
[javac]      ^
[javac] /home/iggy/Documents/javax-usb-ri/src/com/ibm/jusb/UsbConfigurationDescriptorImp.java:12: package javax.usb does not exist
[javac] import javax.usb.UsbConfigurationDescriptor;
[javac] ^
[javac] /home/iggy/Documents/javax-usb-ri/src/com/ibm/jusb/UsbConfigurationDescriptorImp.java:13: package javax.usb.util does not exist
[javac] import javax.usb.util.UsbUtil;
[javac] ^
etc..
I guess it doesn't seem to find the javax.usb library.Or...???
the third does't build either...naturally.
So what am I doing wrong?I'm using Ubuntu 8.10.
Is there any other way to make buld I/O over USB (besides using JNI)?

for jUSB on windows you should read the manual that came with it to enable the specific device as a JUSB device ( the appendixes i think ), it involves going into your device manager i think ( the instructions should say and be simple enough ), i don't like it because it defeats the purpose of being able to plug the device into any usb port and doing a search for it from there and then being able to communicate with it, it also prevents the original app. from communicating with it successfully through the port you configured the device for
by the way the device i used the java usb packages for is the vernier go temp. sensor =) (developing a program to display and record data from it while using it in my chemistry labs which would beat the hell out of standing, stirring, and measuring temp. with an alcohol thermometer to the second decimal place every 15 seconds for about 30 minutes for about 6 rounds with an avg. temp. rate change of about 1 deg. per 80 secs. =( )
Edited by: scphan on Mar 19, 2009 3:40 PM

Similar Messages

  • Properties File: javax.usb ?

    Hi Guys,
    I'm sure you've all heard this a million times, but I'm hung up on it. I'm trying to learn about javax.usb, and keep getting this exception:javax.usb.UsbException: Properties file javax.usb.properties not found.And I swear to God guys, it's there (i know i'm wrong though).
    This is what I've added to my buildpath:
    -javax-usb_1.0.1.zip
    -javax-usb-ri_1.0.1.zip
    -jsr80-1.0.1.jar
    -jsr80_ri-1.0.1.jar
    -javax-usb-tck_1.0.1.zip
    Take a look for yourself: http://img.photobucket.com/albums/v335/shlumph/referencedLibraries.jpg
    How come the compiler can't see that the javax.usb.properties file is there? What is the best way to fix this?
    If it helps, here is my source code:
    import java.io.UnsupportedEncodingException;
    import java.util.*;
    import javax.usb.*;
    public class USBListener {
         public static void main(String[] args) {
              try{
                   UsbServices services = UsbHostManager.getUsbServices();
                   UsbHub root = services.getRootUsbHub();
                   listDevices(root);
              } catch (Exception e) {
                   System.out.println(e);
         public static void listDevices(UsbHub hub) throws UnsupportedEncodingException, UsbException {
              List devices = hub.getAttachedUsbDevices();
              Iterator iterator = devices.iterator();
              while(iterator.hasNext()) {
                   UsbDevice device = (UsbDevice)iterator.next();
                   describe(device);
                   if(device.isUsbHub()) {
                        System.out.println("is hub");
         public static void describe(UsbDevice device)
              throws UnsupportedEncodingException, UsbException {
              UsbDeviceDescriptor descriptor = device.getUsbDeviceDescriptor();
              byte manufacturerCode = descriptor.iManufacturer();
              System.out.println("Manufacturer index: " + manufacturerCode);
              System.out.println("Manufacturer String: " + device.getString(manufacturerCode));
              System.out.println("USB version: " + decodeBCD(descriptor.bcdUSB()));
              System.out.println("Maximum control packet size: " + descriptor.bMaxPacketSize0());
         public static String decodeBCD(short bcd) {
              int upper = (0xFF00 & bcd) >> 8;
              int middle = (0xF0 & bcd) >> 4;
              int lower = 0x0F & bcd;
              return upper + "." + middle + "." + lower;
    }

    Hi,
    Probably you did not set properly your classpath. Read the following FAQ:
    http://javax-usb.org/faq.html#get_properties_file
    http://javax-usb.org/faq.html#what_is_properties_file
    http://javax-usb.org/faq.html#linux_imp_jar_file
    http://javax-usb.org/faq.html#still_doesnt_work
    Note that for Windows: "This is a pre-alpha Windows implementation (it does not work, it needs a kernel driver)."
    http://javax-usb.cvs.sourceforge.net/javax-usb/javax-usb-ri-windows/README?view=markup
    Mimo

  • Error Installing javax.usb

    Hello
    I know that Javax.usb was not created by sun but I'm looking for a solution and it's my last chance.
    I'm trying to install Javax.usb, the installation goes well for the API and the Common RI. Things are going wrong with the Linux RI.
    I Have this message at compilation :
    [moi@eeePC javax-usb-ri-linux]$ ant compile
    Buildfile: build.xml
    compile:
         [echo] Compiling class files.
         [echo] Compiling JNI library.
    BUILD FAILED
    /home/moi/Bureau/javax-usb/javax-usb-ri-linux/build.xml:114: Problem: failed to create taskor type javah
    Cause: the class org.apache.tools.ant.taskdefs.optional.Javah was not found.
            This looks like one of Ant's optional components.
    Action: Check that the appropriate optional JAR exists in
            -/usr/share/ant/lib
            -/home/moi/.ant/lib
            -a directory added on the command line with the -lib argument
    Do not panic, this is a common problem.
    The commonest cause is a missing JAR.
    This is not a bug; it is a configuration problem
    Total time: 1 secondI understand That this is an ANT configuration problem but after much googling I found the class that lacks with a complete Jar file.
    I copied the Jar File and its uncompressed version every on the system
    in /usr/share/ant/lib,/home/moi/.ant/lib and also in many directories. According to the error, it should have been enough but it is not.
    Can someone help me please ?
    System Information :
    ANT : Apache Ant version 1.7.1 compiled on August 2 2008
    Linux : Linux eeePC 2.6.27-desktop-0.rc8.2mnb #1 SMP Thu Oct 2 06:11:56 EDT 2008 i686 Intel(R) Atom(TM) CPU N270 @ 1.60GHz GNU/Linux

    Does anyone have an Idea ?

  • Linux, Java and Javax.usb

    Hello,
    I've spent 3 days trying to install the javax.usb package on my linux with the classical package and I finally found the javax.usb RPMs. I installed them and every thing seemed fine until I tried to run a java program.
    Now I'm unable to run any program.
    Completion does not work anymore e.g. when I'm in a directory with a .class file, the completion is unable to find it.
    That would not be a real problem but when I try to run a java program, I always end up with a ClassNotFoundException. Does anyone have a clue about what is happening to me.
    System : Mandriva 2009.0
    Linux Kernel 2.6

    Packages that begin with "java" are base packages.
    Packages that begin with "javax" are extensions to
    Java (hence the "x").
    AWT was the first UI package in Java. Swing came
    later and was added as an extension.
    %aha, right. cheers

  • Using javax.usb to read usb using java

    hai friends
    iam trying to read data from usb and i had tried over javax,usb package it asks for the implemntation og javax.usb.UsbServices interface. wt is the solution
    with regards hbk

    I want to do it in windows

  • 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();
    traverse(rootHub);
    } 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.
    #

    You've probably forgotten to set the classpath.

  • Javax.usb api

    Hi there, I am used to programming in java since some months but only with simple things. I need to communicate with a usb via my GUI. I found this websites for javax.usb, and also found the some tar files and zip files. http://sf.gds.tuwien.ac.at/j/ja/javax-usb/
    Can somebody explain me how to implement this files and where will the files be stored in the system? I will greatlly appreciate if somebody can show me how the topology works and how many files i need to just get the data from usb into m system gui. I am looking for a common platform code if any out there.
    thanks for the help...

    Hi there, I am used to programming in java since some
    months but only with simple things. I need to
    communicate with a usb via my GUI. I found this
    websites for javax.usb, and also found the some tar
    files and zip files.
    http://sf.gds.tuwien.ac.at/j/ja/javax-usb/
    Can somebody explain me how to implement this files
    and where will the files be stored in the system? I
    will greatlly appreciate if somebody can show me how
    the topology works and how many files i need to just
    get the data from usb into m system gui. I am looking
    for a common platform code if any out there.
    thanks for the help...

  • Javax.usb problem

    i would like to use window xp to test this program
    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();
    traverse(rootHub);
    } 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.
    error message
    C:\TraverseUSB.java:1: package javax.usb does not exist
    import javax.usb.*;
    ^
    C:\TraverseUSB.java:18: cannot resolve symbol
    symbol : class UsbDevice
    location: class TraverseUSB
    public static void traverse(UsbDevice device)
    ^
    C:\TraverseUSB.java:12: cannot resolve symbol
    symbol : class UsbServices
    location: class TraverseUSB
    UsbServices services = UsbHostManager.getUsbServices();
    ^
    C:\TraverseUSB.java:12: cannot resolve symbol
    symbol : variable UsbHostManager
    location: class TraverseUSB
    UsbServices services = UsbHostManager.getUsbServices();
    ^
    C:\TraverseUSB.java:13: cannot resolve symbol
    symbol : class UsbHub
    location: class TraverseUSB
    UsbHub rootHub = services.getRootUsbHub();
    ^
    C:\TraverseUSB.java:23: cannot resolve symbol
    symbol : class UsbHub
    location: class TraverseUSB
    List attachedDevices = ((UsbHub) device).getAttachedUsbDevices();
    ^
    C:\TraverseUSB.java:26: cannot resolve symbol
    symbol : class UsbDevice
    location: class TraverseUSB
    traverse((UsbDevice) attachedDevices.get(i));
    ^
    7 errors
    Tool completed with exit code 1
    also i would like to ask when i run this program, what package do it use. and how can i run this program.

    Hi, i've tried this code as well.. i manage to solve your error, but i cant get it to run properly.
    meaning, the program cant read the device at all. i also had teh same code as you, i got it from somewhere, but it don't seem to work.. can anyone help me?
    System.out.println("hello");
    UsbServices services = UsbHostManager.getUsbServices();
    System.out.println("hello1");
    UsbHub rootHub = services.getRootUsbHub();
    System.out.println("hello2");
    traverse(rootHub);
    System.out.println("hello3");
    the output is only hello.
    so i don't know what is wrong.. anyone any idea?
    download link: [http://sourceforge.net/project/showfiles.php?group_id=21114]

  • Javax.usb.properties..where do I get it from?!

    Hello,
    I'm trying to make a lil application that would access a blood pressure monitor via usb..
    I keep getting the javax.usb.properties file not found, like lots of people are, but..I can't even find that file so I can add it to the CLASSPATH!
    I'm using linux..I downloaded the .jar file with the 'common implementation' and added it to the project..but it's not workign and I have no clue where to find that file..
    I'm sorry, I'm sort of new to this whole thing..so the question is prolly stupid..
    thanks,
    Leena

    Trial versions require no serial number. They run for 30 days without one.
    Mylenium

  • How to get the package javax.usb

    Hi ,
    I need the package javax.usb.*; Please help me to download this.. its very urgent

    A simple search will do: http://sourceforge.net/project/showfiles.php?group_id=21114

  • Error while reading USB Port : using JSR80

    Hi Everybody
    Iam trying to read the data from a usb device [a fingerprint scanner] by using jsr80 with the help of following files which are in my classpath
    1) jsr80-1.0.1.jar
    2) jsr80_ri-1.0.1.jar
    3) jsr80_windows.jar
    4) commons-logging-api-1.1.1.jar
    5) javax.usb.properties
    6) LibusbJNI.dll
    7) LibusbJava.dll
    8) libusb0.dll
    I was trying the follwoing program
    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();
    System.out.println("Getting Available USB Services ");
                  UsbHub rootHub = services.getRootUsbHub();
    System.out.println(" Access to the USBrootHub ");
                  traverse(rootHub);
              } catch (Exception e) {
              System.out.println(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
         System.out.println("USB Device");
                 // This is a USB function, not a hub.
                 // Do something.
    }but when iam executing the program iam getting the exception
    The Ordinal 44 could not be located in the dynamic link library "libusb0.dll" , it is coming in a message box
    javax.usb.UsbException: Error while loading shared library LibusbJNI.dll : C:\WINDOWS\LibusbJNI.dll:
    The operating system cannot run %1
    Please help in this regards
    Thanks in adv
    Sulfikkar

    I am also facing the same problem with the code and getting errors while running my application in Eclipse is this some version problem or any other isues are afftecting my application to run successfully.
    I get following errors while running my application inspite of having all the jars and libusb for windows:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
         at com.mcreations.usb.windows.JavaxUsb.<clinit>(JavaxUsb.java:65)
         at com.mcreations.usb.windows.WindowsUsbServices.<init>(WindowsUsbServices.java:46)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at javax.usb.UsbHostManager.createUsbServices(Unknown Source)
         at javax.usb.UsbHostManager.getUsbServices(Unknown Source)
         at org.symphony.embedded.ShowTopology.getVirtualRootUsbHub(ShowTopology.java:56)
         at org.symphony.embedded.FindUsbDevice.main(FindUsbDevice.java:29)

  • Problem while reading data  from USB with JSR80

    Hi
    Iam using Fedora 9 with 32 bit.
    Iam using JSR80 api to read the data from USB devices.
    I successfully set-up the code as per given on JSR80 site on my eclipsce ide.
    below is my code which iam using to read data from usb
    import com.ibm.jusb.*;
    import java.util.List;
    import javax.usb.*;
    import java.util.List;
    public class USBReader {
    public static  UsbInterface interf = null;
         public static void main(String[] args) {
              try
            {// Access the system USB services, and access to the root
             // hub. Then traverse through the root hub.
               System.out.println("Application started");
             UsbServices services = UsbHostManager.getUsbServices();
             UsbHub rootHub = services.getRootUsbHub();
             traverse(rootHub);
             testIO(rootHub);
            } catch (Exception e) {
                 System.out.println("The Exception occured"+e.getMessage());
          public static void traverse(UsbDevice device){
               System.out.println("Iam in traverse ");
               if (device.isUsbHub()){  
                    // This is a USB Hub, traverse through the hub.
                    System.out.println("The device is hub");
                    List attachedDevices = ((UsbHub) device).getAttachedUsbDevices();
                    System.out.println("The attached devices size:"+attachedDevices.size());
                    for (int i=0; i<attachedDevices.size(); i++){
                         traverse((UsbDevice) attachedDevices.get(i));
                    if(attachedDevices !=null){
                         for(int j=0;j<attachedDevices.size();j++){
                              System.out.println("The device is"+attachedDevices.get(j));
           else{
              // This is a USB function, not a hub.
              // Do something.
                System.out.println("The device is not hub");
          public static void testIO(UsbDevice device) throws UsbClaimException, UsbNotActiveException, UsbDisconnectedException, UsbException{
               System.out.println("Iam in testIO");
              try{
                 // Access to the active configuration of the USB device, obtain
                 // all the interfaces available in that configuration.
                 UsbConfiguration config = device.getActiveUsbConfiguration();
                 List totalInterfaces = config.getUsbInterfaces();
                 System.out.println("The Total interfaces: "+totalInterfaces.size());
                 // Traverse through all the interfaces, and access the endpoints
                 // available to that interface for I/O.
                 for (int i=0; i<totalInterfaces.size(); i++){
                    interf = (UsbInterface) totalInterfaces.get(i);
                    System.out.println("The interfaces are "+totalInterfaces.get(i));
                    String strinf=interf.getInterfaceString();
                    System.out.println("Claimed Status: "+interf.isClaimed());
                    System.out.println("Active status : "+interf.isActive());
                    System.out.println("Settings :"+interf.getNumSettings());
                    //interf.release();
                    interf.claim();
                    List totalEndpoints = interf.getUsbEndpoints();
                    for (int j=0; j<totalEndpoints.size(); j++){
                       // Access the particular endpoint, determine the direction
                       // of its data flow, and type of data transfer, and open the
                       // data pipe for I/O.
                       UsbEndpoint ep = (UsbEndpoint) totalEndpoints.get(i);
                       int direction = ep.getDirection();
                       int type = ep.getType();
                       UsbPipe pipe = ep.getUsbPipe();
                       pipe.open();
                       // Perform I/O through the USB pipe here.
                       pipe.close();
                    interf.release();
              } catch (Exception e) {
                   System.out.println("Exception in TestIO"+e.getMessage());
                   e.printStackTrace();
    }When i execute the above code i get the following exception
    Exception in TestIOCannot claim an interface on a virtual root hub.
    javax.usb.UsbException: Cannot claim an interface on a virtual root hub.
         at com.ibm.jusb.VirtualRootUsbHubImp$VirtualRootUsbInterfaceOsImp.claim(VirtualRootUsbHubImp.java:143)
         at com.ibm.jusb.os.DefaultUsbInterfaceOsImp.claim(DefaultUsbInterfaceOsImp.java:54)
         at com.ibm.jusb.UsbInterfaceImp.claim(UsbInterfaceImp.java:109)
         at com.ibm.jusb.UsbInterfaceImp.claim(UsbInterfaceImp.java:83)
         at USBReader.testIO(USBReader.java:60)
         at USBReader.main(USBReader.java:15)iam not getting the clue for it .

    Cannot claim an interface on a virtual root hubSo don't do that? I have no idea how to tell, but clearly you need to test a few more attributes before you claim. Or else just log the claim error and continue with the next interface.

  • Java - USB I/O

    Hello,
    I have problems with the running of my USB app.  I get a error of "Exception in thread "main" javax.usb.UsbException: Properties file javax.usb.properties not found."...
    Well, I have killed Google with this error, but still no luck. This is the only answer I could find : http://javax-usb.org/faq.html#what_is_properties_file.
    I have already setup my CLASSPATH.  And I have all the needed packages. My code doesn't give any error on compiling, but only on running the app.
    Please Help me?? Its very, VERY urgent!!
    Thanks you.
    Jo

    JaVaSpiKe wrote:
    I thought this was the place to come for help... But instead you are over looking my question and telling me how to ask it... Thanks for nothing.Stamping you feet like a petulant child won't help either.
    There are at least two ways java supports USB - some USB devices manifest themselves as other devices e.g. serial ports, disk drives LAN cards etc. These devices may be addressed using the java support for those classes of device.
    Otherwise there are some third-party libraries - such as the one you have found - which may or may not work in you particular circumstance. But you best support for those libraries is the libraries own web site/support board.

  • USB Port support?

    Hi,
    There is JavaComm API for Serial and Parallel Port in Java.
    What about the USB Port? How Can communicate through USB Port?
    plz, suggest me the sides, code
    Thanks
    Pramod Kadam

    I believe there is a JSR called Java for USB API or IBM has a Java API for USB or a package called javax.usb....something like that !

  • Problem while running USB port detection

    Hi,
    Im having the sample program of USB detection using java.
    it didn't show any compile error but it is showing run time exception.
    That is
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
    gging/LogFactory
    at com.mcreations.usb.windows.JavaxUsb.<clinit>(JavaxUsb.java:65)
    at com.mcreations.usb.windows.WindowsUsbServices.<init>(WindowsUsbServic
    es.java:46)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
    onstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at javax.usb.UsbHostManager.createUsbServices(Unknown Source)
    at javax.usb.UsbHostManager.getUsbServices(Unknown Source)
    at SampleUSBTest.<init>(SampleUSBTest.java:23)
    at SampleUSBTest.main(SampleUSBTest.java:16)
    The program is:
    import javax.usb.*;
    import javax.usb.event.*;
    public class HotplugListener implements UsbServicesListener
    public void usbDeviceAttached(UsbServicesEvent event)
    UsbDevice device = event.getUsbDevice();
    System.out.println(getDeviceInfo(device) + " was added to the bus.");
    public void usbDeviceDetached(UsbServicesEvent event)
    UsbDevice device = event.getUsbDevice();
    System.out.println(getDeviceInfo(device) + " was removed from the bus.");
    private static String getDeviceInfo(UsbDevice device)
    try
    String product = device.getProductString();
    String serial = device.getSerialNumberString();
    if (product == null) return "Unknown USB device";
    if (serial != null) return product + " " + serial;
    else return product;
    catch (Exception ex)
    return "Unknown USB device";
    pls help me to run this progam.
    Thanks and Regards,
    Selvi
    Edited by: TamilSelviSubramani on Mar 11, 2008 8:54 AM

    hi,
    I added the commons-logging-1.1.jar file in classpath.But now itself it shows another run time Exception
    That is,
    javax.usb.UsbException: Error while loading shared library LibusbJNI.dll : no Li
    busbJNI in java.library.path
    at com.mcreations.usb.windows.JavaxUsb.loadLibrary(JavaxUsb.java:400)
    at com.mcreations.usb.windows.JavaxUsb.initialise(JavaxUsb.java:329)
    at com.mcreations.usb.windows.WindowsUsbServices.<init>(WindowsUsbServic
    es.java:46)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
    onstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at javax.usb.UsbHostManager.createUsbServices(Unknown Source)
    at javax.usb.UsbHostManager.getUsbServices(Unknown Source)
    at SampleUSBTest.<init>(SampleUSBTest.java:23)
    at SampleUSBTest.main(SampleUSBTest.java:16)
    Thanks and Regards,
    Selvi

Maybe you are looking for

  • Required JAR's for developing custom adapter modules for PI 7.31 SP 09

    Hello experts, I have a new development wherein i have to consume .xlsx files in PI 7.31 i have gone through a lot of blogs but did not find any relevant JAR's specially for PI 7.31, I am planning  to go for custom module development for conversion o

  • Help needed in configuring Dynamic F4

    Hi All I am trying to configure Dynamic F4 help for Actvities appln. In Actvities Appln I have the Partners tab.In this Partner tab I have partner function and partner Id fields. When I make a search for partner Id  I need to launch  the search scree

  • Shortdump problem for loadinf data from ODS to InfoCube

    hai im trying to load the data from ODS to InfoCube.But i got the following error like below Short dump in the Warehouse Diagnosis The data update was not completed. A short dump has probably been logged in BW providing information about the error. <

  • ARD Task server email notification trouble shooting

    I have set up my ARD Task Sever successfully. I am able to push out task from my machine to the task sever. I have set up the default mail script and was able to test it manually by running ./Notify and get an email. When I have a job set up to run I

  • CS6 uninstall instructions

    Hi. This is going to sound like a completely dumb question but as I can't remember what I did last time and couldn't seem to find the answer on google either I decided it might be for the best just to make a discussion here (no matter how short its g