• 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

Drive Problem

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Plz anyone tell me that how can i deduct the CD ROM Drive i.e It is D: or F: or any colon plz help me
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That would be operating system specific.
 
Dishi Malhotra
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
candy i can't get u what u want to say but i want to deduct from programing
 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there's another one calling you "candy"...
must be because you are so <h3>sweet</h3>
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is platform independent, and knows nothing about drives, CD-ROM or otherwise. It only knows how to open a File, given a path to the file. If you know the path to a file on the CD-ROM, you can tell Java to open it for you, but it does not know or care whether a file is on a CD-ROM, DVD, Floppy, IDE dosk, SCSI disk, ramdisk, flash ram card or mounted over the network.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dishi Malhotra:
Plz anyone tell me that how can i deduct the CD ROM Drive i.e It is D: or F: or any colon plz help me


Hi Dishi
Finding a drive or looking at the properties of a file/directory all these are lowlevel/machinelevel operations. You need to call a lowlevel function for this but as far as I know there is no such API call in JDK.
Java was invented to avoid these lowlevel botherings
Siva Prasad
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll expand on what Cindy said: It's OS dependent. If you want to find a CD-ROM drive or a floppy, you will need to call out of Java to the native operating system. To do this, I think that you would use JNI, but I am not really sure.
Windows has a couple of API calls that will help you deduce what drive might be a CD-ROM, but you cannot be sure, unless there are additional new functions I am unaware of. From what I remember, the function would return a drive letter and the type of drive, either fixed or removable. You could guess that a removable drive higher than C: is a CD-ROM, but then you could be wrong with Zip drives.
Unfortunately, I don't know the function name off-hand, but a check thru Microsoft's site or Petzgold's book should turn it up.
 
Siva Prasad
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bruce Wingate:

Unfortunately, I don't know the function name off-hand, but a check thru Microsoft's site or Petzgold's book should turn it up.


It is.. getdrive() API call in Win SDK.
 
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i think you can call native api from windows sytem to get this working.
 
For my next trick, I'll need the help of a tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic