Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Bruno Frascino
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java doesn't offer any access to this kind of information. You'd have to execute an external program, or use native methods.
 
Bruno Frascino
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok!
Thanks Ernest!
 
Bruno Frascino
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
About the last question... Why java cannot access this kind of information?!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic