Hello,

I am current try to write a JAVA program to setup and configure NIS+ on my Solaris 10 X86 machine.
However i had faced a problem that is how to capture or how to read the question from NIS+ script: "Is this information correct? (type 'y' to accept, 'n' to change) ".
Below is my code:

import java.io.BufferedReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author root
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String [] args) throws IOException {
String cmd1 = "/usr/lib/nis/nisserver -v -r -d" ;
String cmd2 = "doc.com." ;
Runtime run = Runtime.getRuntime();
Process pr = run.exec(cmd1+cmd2);
System.out.println(pr.exitCode());
BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));

String line = "";
do {
System.out.println(line);
}while ((line=buf.readLine())!=null);


}
}

I hope any guys can help me to overcome this problem as soon as possible.
Thank you very much.


From,

java_newbie