Need help to find the VID/PID of the usb drive con

2019-01-19 13:22发布

问题:

I need to find the vendor Id, Product Id of the usb drive connected to the system, through java code. Any suggestions...

回答1:

I have never interfaced with USB in Java before, but have a look at JSR-80 (javax.usb) API. IBM DeveloperWorks have a tutorial (which can be useful).



回答2:

If you need windows only use WMI. I do not think that cross-platform pure java solution exists at all. You have several ways to connect to WMI. Check out Jawin, Jintegra, Jinterop. All these libraries support WMI. You can also create WMI script using VBScript or JScript and run as an external command line tool from Java using cscript command.



标签: java usb