This discussion is archived
3 Replies Latest reply: Mar 27, 2011 7:17 AM by 824073 RSS

jUSB API

850696 Newbie
Currently Being Moderated
Is there a Java API that supports communication with devices connected through USB port?
  • 1. Re: jUSB API
    824073 Explorer
    Currently Being Moderated
    No there is not. There has been lots of discussion wether it should be part of the JRE or not and there have been some attempts (like jUSB) but there is nothing that works well on all operating systems. If you're going to write an application that communicates with USB devices I would recommend a language that's closer to the OS than Java.
  • 2. Re: jUSB API
    850696 Newbie
    Currently Being Moderated
    Thank you.Actually i would like to make GUI application that communicates with external device based on microcontroller through USB port.What language closer to the OS do you reccomend me to acchieve that communication?
  • 3. Re: jUSB API
    824073 Explorer
    Currently Being Moderated
    Well these micro-controller devices very often open a serial (COM) port over the USB connection. If this is the case (it probably will be), you can use this serial port to communicate with the microcontroller. You're limited to a serial port of course (this means slow speeds, typically around 9600bps (that's bits per second)), but if it's just to exchange some commands and/or control information, this will be enough. You can use the rxtx library (http://users.frii.com/jarvi/rxtx/) with Java.

    If on the other hand you need full usb support you'll best use a language that's closer to the OS, like C++. The big disadvantage is you loose cross-platform support. If you decide to go down this path, you could also consider using C#, which is closer to Java in syntax and supports USB trough native calls (see http://www.developerfusion.com/article/84338/making-usb-c-friendly/ for an example).

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points