Portable way of finding total disk size in Java (pre java 6)
- by Wouter Lievens
I need to find the total size of a drive in Java 5 (or 1.5, whatever). I know that Java 6 has a new method in java.io.File, but I need it to work in Java 5.
Apache Commons IO has org.apache.commons.io.FileSystemUtils to provide the free disk space, but not the total disk space.
I realize this is OS dependant and will need to depend on messy command line invocation. I'm fine with it working on "most" systems, i.e. windows/linux/macosx. Preferably I'd like to use an existing library rather than write my own variants.
Any thoughts? Thanks.