Disk size

Discussions

General J2EE: Disk size

  1. Disk size (2 messages)

    Can I get disk size and its free space from a java program?

    Thanks

    Threaded Messages (2)

  2. Disk size[ Go to top ]

    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
  3. Disk size[ Go to top ]

    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