Menu

Problem with USB serial connection

Help
yanis
2015-03-26
2016-01-26
  • yanis

    yanis - 2015-03-26

    Our product/s are embedded system.
    Till now i work at JSystem with products with RS232 ports and no problem (by using javax.comm./comm.jar)
    One of the new products has USB connection (VCP), I am trying recognize when this USB device plugged in/unplugged (I added jsr80-1.0.1.jar to my referenced libraries in eclipse )
    I copy the jsr80-1.0.1.jar to mine project lib folder and also at C:\jsystem\runner\lib
    The problem i get "java.lang.NullPointerException" when execute line UsbServices services = UsbHostManager.getUsbServices();

    Does anyone encounter such problem?

     
  • yanis

    yanis - 2015-05-25

    Now i have a new problem .....
    (The previous problem solved i download all relevant files from http://usb4java.org/index.html#).

    The problem now is when i run a BB thru JSystem there is the following exception:
    [jsystem] javax.usb.UsbException: Properties file javax.usb.properties not found.
    [jsystem] at javax.usb.UsbHostManager.setupProperties(Unknown Source)
    [jsystem] at javax.usb.UsbHostManager.getProperties(Unknown Source)
    [jsystem] at javax.usb.UsbHostManager.createUsbServices(Unknown Source)
    [jsystem] at javax.usb.UsbHostManager.getUsbServices(Unknown Source)

    When i run from eclipse as JUnit test there is no such problem

    The file javax.usb.properties put it at:
    lib folder
    classes folder
    tests folder

    Why when i run JSystem can not find file javax.usb.properties?

     
  • Alex Sigal

    Alex Sigal - 2015-05-25

    Try to copy the jar under /runner/lib

     
  • yanis

    yanis - 2015-05-25

    Thanks Alex for your response,

    After spending few hours among other things reading forums....

    Already out of desperation i copy this files in several folders (and still there is problem):
    runner\lib
    runner\thirdparty\commonLib
    runner\thirdparty\lib
    Program Files\Java\jdk1.6.0_45\lib
    Program Files\Java\jdk1.6.0_45\jre\lib
    Program Files\Java\jdk1.6.0_45\jre\lib\ext

    Any other suggestions?

     
  • yanis

    yanis - 2016-01-26

    I back to this problem and looks like i found solution...

    When i run from eclipse the file "javax.usb.properties" is read from <mineProjectPath>\classes
    When i run from JSystem the file "javax.usb.properties" is read from <JDK_folder>\jre\classes

    To tell the truth i dont understand this solution, why i needed to create folder classes and put this property file in to it?
    Any advices? better solution?

    Another issue - that maybe related to mine problem - i found at runner folder file ".ant.properties" one of it property is:
    sun.boot.class.path=C\:\\Program Files\\Java\\jdk1.6.0_45\\jre\\lib\\resources.jar;C\:\\Program Files\\Java\\jdk1.6.0_45\\jre\\lib\\rt.jar;C\:\\Program Files\\Java\\jdk1.6.0_45\\jre\\lib\\sunrsasign.jar;C\:\\Program Files\\Java\\jdk1.6.0_45\\jre\\lib\\jsse.jar;C\:\\Program Files\\Java\\jdk1.6.0_45\\jre\\lib\\jce.jar;C\:\\Program Files\\Java\\jdk1.6.0_45\\jre\\lib\\charsets.jar;C\:\\Program Files\\Java\\jdk1.6.0_45\\jre\\lib\\modules\\jdk.boot.jar;C\:\\Program Files\\Java\\jdk1.6.0_45\\jre\\classes

    Looks like each time that i run from JSystem this file is created but who set this path "C\:\Program Files\Java\jdk1.6.0_45\jre\classes"?

     

Log in to post a comment.