GetFreeDiskSpace () in Java 5

I am looking for a convenient and easy way to display free space on a specific hard drive in my Java application.

I am very surprised that this is only implemented in java 6 thanks to the getFreeSpace () method in the File class.

Unfortunately we are using java 5 and don't want to change that at the moment.

Is there a way to do this in java 5?

Thank!

+2


source to share


3 answers


Apache Commons IO provides FilesystemUtil.freespaceKb , which works by issuing platform-specific process commands to Runtime. Quite ugly underneath, no doubt about it, but nice and easy on the surface.



+7


source


Maybe this can help you:

http://commons.apache.org/io/api-release/org/apache/commons/io/FileSystemUtils.html



Current functions:

* Get the free space on a drive 

      

+1


source


You can use Apache's org.apache.commons.io.FileSystemUtils .

0


source







All Articles