How can I use Java to communicate to device through USB port?

夙愿已清 提交于 2019-12-04 03:30:36

The only USB API I could find for Windows is here. Seems as if it has limited functionality, but it might suit your needs. A more complete UNIX API is also available.

ETA: Found a link to the official Java USB implementation, but looks like the windows version is still in alpha.

The native code API I referred to was the Windows DDK, i.e. the Driver Development Kit. The modern version seem to be called Windows Driver Kit, so google for Windows WDK :) There should be a few C samples on how to communicate with USB devices, and it should be pretty straightforward to write a JNI wrapper from those.

As a quick thought, you could use JNI, the Java Native Interface. I've never used it myself though.

I found this page that explains how to perform a communication between a microcontroller and a java application: http://javausbapi.blogspot.com/

The Best way I found to communicate with USB is through RxTx library.

You can find an example of the usage here: http://www.snip2code.com/Snippet/1044/Java--read-from-USB-using-RXTX-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!