This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to access HD info like, size, free space..? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to access HD info like, size, free space..?" Watch "How to access HD info like, size, free space..?" New topic
Author

How to access HD info like, size, free space..?

Bruno Frascino
Ranch Hand

Joined: Jul 22, 2003
Posts: 55
Hi,
I would like to know if is possible to access HD info, like size, free space, and, wich package, or class from API I have to use for this!?
Thanks for any help!
Sorry about my english!


--BJCK--
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Java doesn't offer any access to this kind of information. You'd have to execute an external program, or use native methods.


[Jess in Action][AskingGoodQuestions]
Bruno Frascino
Ranch Hand

Joined: Jul 22, 2003
Posts: 55
Ok!
Thanks Ernest!
Bruno Frascino
Ranch Hand

Joined: Jul 22, 2003
Posts: 55
Hi,
About the last question... Why java cannot access this kind of information?!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

In general, Java doesn't have APIs to access things that are intrinsically platform-dependent. Some things that run Java don't have disks, for example, and different OS's treat even the seemingly basic notion of "free space" very differently.
Frankly, though, personally I think this is a weak excuse, and you could make a pretty good case as to why there should be an API for volume info like this.
 
Don't get me started about those stupid light bulbs.
 
subject: How to access HD info like, size, free space..?