Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to format an USB drive from Java code?

Ravi_TejaNov 16 2012 — edited Nov 19 2012
I tried with the code "Process p =Runtime.getRuntime().exec(sFormatCmd);" but landing up with the following error:

java.io.IOException: Cannot run program "format": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at java.lang.Runtime.exec(Runtime.java:615)
at java.lang.Runtime.exec(Runtime.java:448)
at java.lang.Runtime.exec(Runtime.java:345)

Can somebody help me regarding the same?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2012
Added on Nov 16 2012
3 comments
1,397 views