The parameter to the exec should be the command that has to be executed, in your case you must give "javac to compile and
java to execute".
Process p = Runtime.getRuntime().exec("javac Test.java");
Then you can use any one of these methods of process class, depends of your need, getInputStream will return the result of the executed process.
public abstract java.io.InputStream getErrorStream();
public abstract java.io.InputStream getInputStream();
public abstract java.io.OutputStream getOutputStream();