I am looking to get accurate (i.e. the real size on disk and not the normal size that includes all the 0\'s) measurements of sparse files in Java.
In C++ on Windows one
Since an answer was given for windows. i will try to supply for Linux.
I am not sure, but i think it will do the trick (C++):
#include ioctl(file, BLKGETSIZE64, &file_size_in_bytes);
This can be loaded in the same way that was described in the @Aniket answer (JNI)