views:

33

answers:

3

Is there a Java library/API available to interact with Windows OS, like executing commands on the command prompt and returning the output back to the program?

+4  A: 

You can use java.lang.Runtime.exec() to do it, but read this first.

duffymo
A: 

Good article here: Runtime.exec() and the API is here: link text

Rulmeq
+1  A: 

Use the ProcessBuilder, which is available starting from Java 1.5!

It has the nice ability to let you redirect the error stream which makes you only have to cope with one InputStream to read from.

Daniel