Link to home
Start Free TrialLog in
Avatar of Sthokala
SthokalaFlag for United States of America

asked on

How do I get the file size on disk?

Hi,
  How can I get file size on the disk in java? file.length() is not giving the size on the disk, but giving the actual size of file. Please let me know how can I get that.

Thanks
Avatar of Mick Barry
Mick Barry
Flag of Australia image

java will not give that to you, you'll need to make a native call using JNI or calling Runtime.exec()
Avatar of Sthokala

ASKER

Hi,
  Thanks for your reply. can you please post the sample code..

Thanks
it would depend on the platform, java doesn't support getting that
Are you using Windows?
ASKER CERTIFIED SOLUTION
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
good
:-)