Monday, August 18, 2014

StdInput and StdOutput



Java Code:



public static void runConfigure(String[] refBox1,String outDir2)
throws IOException{

String s = null;

try {

// run the Unix "ps -ef" command
// using the Runtime exec method:

Process p = Runtime.getRuntime().exec("cmd.exe /c C:\\eyetest\\install\\configure.exe text");

BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));

BufferedWriter stdOutput = new BufferedWriter(new
OutputStreamWriter(p.getOutputStream()));

BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));




// read the output from the command

System.out.println("Here is the standard output of the command: \n ");
int ch;
while ((ch = stdInput.read()) != -1) {
System.out.print((char)ch);


}



the above code returns:

[Ljava.lang.String;@1c8825a5

Index[0]=ent-14-0-win-20140417.zip

Here is the standard output of the command:


os name: windows 7

Running on Windows

Host Identifier:

To improve system performance strongly recommend the server's MaxUserPort registry value is increased to 65534 (for more details see the Getting Started Guide).

Update the registry automatically [Yes]>


based on the above output , how would i go about feeding my response to configure as either yes or no and going on to the next configure option. I do understand this may seem very easy and straight forward for some , please kindly understand it is not for me, your help and feedback would be appreciated.



No comments:

Post a Comment