• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

get drive letter of removable media

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I don't know where to post this, but hoping for some responses.

My java swing application needs to access a removable media device to download files from it.
The removable media device is (Olympus dictation recorder). An API is provided. When the device is connected to the Windows machine, a drive letter is automatically assigned to it by Windows.
Now from my java swing application, I need to know the drive letter where this device is connected, to access the files in the device?

The api provides certain api functions to return the device id, model no. etc.

How do I get the drive letter where this device is mapped to?

Thanks,

Nikki
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe I'm wrong about this, but if the OS assigns a drive letter to the device, then you should be able to access its files in the way you access files on any other drive. So if you're opening a file, you need to pass in the fully qualified path containing the drive letter. Maybe you'll need to use the special API to do what you need to do with those files, but I imagine telling Java where the files are is handled by the OS when it assigns a drive letter.
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can get a list of device letters using File.listRoots(). The chances are that Windows will give the next free available drive letter to the removeable media. However this is not foolproof because you may have mapped drives further down the letter chain.
 
nikki mateti
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for the responses. I can get a list of roots using listRoots, but how do I know which drive letter gives access to this particluar removable device.

I can use jni if that is required.

nikki
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic