title: Detect USB Drive in Java
body: <p>How can I detect when a USB drive is attached to a computer in Windows, Linux, or Mac?</p>
  
  <p>The only way I have seen online to do this is to iterate the drives, but I don't think there is a very good way to do that cross-platform (e.g. File.listRoots() in Linux only returns "/"). Even in Windows this would cause problems reading from every device, such as a network drive that takes a long time to access.</p>
  
  <p>There is a library called jUsb that sounds like it accomplishes this in Linux, but it doesn't work in Windows. There is also an extension to this called jUsb for Windows, but that requires users to install a dll file and run a .reg. Neither of these seem to be developed for several years, so I'm hoping a better solution exists now. They're also overkill for what I need, when I only want to detect if a device is connected that contains a file I need.</p>
  
  <p>[Edit] Furthermore, jUsb apparently doesn't work with any recent version of Java, so this isn't even an option...</p>
  
  <p>Thanks</p>