Can I get disk size and its free space from a java program?
Thanks
-
Disk size (2 messages)
- Posted by: Tim Prize
- Posted on: May 04 2004 05:43 EDT
Threaded Messages (2)
- Disk size by venkata allamsetty on May 04 2004 16:59 EDT
- Disk size by Stephane Vaucher on May 05 2004 02:58 EDT
-
Disk size[ Go to top ]
- Posted by: venkata allamsetty
- Posted on: May 04 2004 16:59 EDT
- in response to Tim Prize
Can I get disk size and its free space from a java program?Thanks
Look at java.lang.Runtime.
As per the Java doc,
Runtime.freeMemory()
- Returns the amount of free memory in the system. Calling the gc method may result in increasing the value returned by freeMemory
Runtime.totalMemory()
- Returns the total amount of memory in the Java Virtual Machine. The value returned by this method may vary over time, depending on the host environment.
hope that helps
Venkata Allamsetty -
Disk size[ Go to top ]
- Posted by: Stephane Vaucher
- Posted on: May 05 2004 02:58 EDT
- in response to Tim Prize
Don't think so. To get hard drive info, you probably need to use System.exec. You can always take a look at java os projects (as any os should be able to return this info).
HTH,
sv