Need help to find the VID/PID of the usb drive connected to the system through java code
I need to f开发者_高级运维ind the vendor Id, Product Id of the usb drive connected to the system, through java code. Any suggestions...
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).
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.
精彩评论