Listing USB Devices on Windows with Java

It was mentioned in a previous SO question that USB devices can be mounted using the following approach on Windows:

MOUNTVOL C: \ USB: \\? \ Volume {ebc79032-5270-11d8-a724-806d6172696f} \

My question is what is a String starting with \\? \ Volume and what's the best way to get that. I would rather not use .NET if possible, because you cannot "layered" the .NET runtime without physically installing it on the machine as far as I know.

I would also like to use JNA if possible.

+1


source to share


2 answers


You cannot bundle Java "... runtime without physically installing on the machine ...".

Listing the device after installation should be simple. In fact, installing a device doesn't have to be easy, as Java (and .NET) is designed to abstract the hardware.

I recommend that you choose a more suitable tool for this. Or just choose a different process to run the mount command (knowing it won't be portable), or choose a tool that doesn't abstract hardware, or at least less (Python perhaps?).



EDIT: Clarification when installing JVM ...

Great point - installing the JVM can be much less invasive than installing .NET, as the latter MUST integrate with the OS, while the former MAY just integrate with the OS. So yes, including a private JVM installation, is viable and possibly desirable.

NOTE. The question includes a mount command for a USB device, which tends to highlight this aspect as a core requirement.

+1


source


What USB device are you looking for? The bit you cite only applies to USB drives and not USB devices in general.



0


source







All Articles