Possible Duplicate:
Is it possible to format a memory stick, pen drive or disk using Java?
I need to format my pendrive into NTFS file system using a Java program. Can you please tell me how can I do this? Thank you
Possible Duplicate:
Is it possible to format a memory stick, pen drive or disk using Java?
I need to format my pendrive into NTFS file system using a Java program. Can you please tell me how can I do this? Thank you
Run native command line utilty of OS you are using. For example format c:
on Windows :)
Use either Runtime.getRuntime().exec()
or ProcessBuilder
for this.
Disk formating is a responsibility of file system that strongly depends on platform. Java is a cross-platform and I doubt it has (and even can or should have) such built-in functionality unless somebody already created library that wraps platform specific calls I mentioned and provides pure java API.
you can not format directly. You will need to invoke a operating system specific program to do the actual work for you. check this link this might help you