Q:

Executing command line using "Runtime.getRuntime().exec()"

I'm having a problem while executing a command line from Java code.
This is the code I use, and under the code are the errors I got.
I also tried using ProcessBuilder but I got the same errors.
Ps: I am running the program on Windows.
public class Test {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    try {
        Process compilerProcess = Runtime.getRuntime().exec("clafer -k -m choco clafer.cfr);

        BufferedReader stdInput = new BufferedReader(new InputStreamReader(
                compilerProcess.getInputStream()));
            String s = null;
            while ((s = stdInput.readLine()) != null) {
             System.out.print(s);        }  
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // To have access to the text generated by the compiler.

}

}

The error:
java.io.IOException: Cannot run program "echo": CreateProcess error=2, the 
  specified file is not found
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at eqe.Test.main(Test.java:12)
Caused by: java.io.IOException: CreateProcess error=2, the specified file 
is not found
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 5 more

A:

I found the solution to the problem. I simply put the command line into new String[] and worked.
Here is the solution for using to command line that allows you to execute long command line.
Process compilerProcess = Runtime.getRuntime().exec(new String[]{"clafer","-k","-m","choco","clafer.cfr" });

