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!

help with executing windows command in java

807606Feb 12 2007 — edited Feb 12 2007
hi, i am trying to execute dos command in java. currently i am trying simply to create a folder in the current directory.

here is the code snippet:

try {
Process p = Runtime.getRuntime().exec("md myFolder");
} catch (IOException io) {
io.printStackTrace();
}

i have also tried using "mkdir" instead of "md". but my code just throws an exception that says:

java.io.IOException: CreateProcess: md myFolder error=2

what have I done wrong? thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 12 2007
Added on Feb 12 2007
13 comments
215 views