I'm trying to create a process in java that starts a external file that asks for a number of arguments which the user gives at execution time.
The question is how to determine if the precess is asking for a argument
ProcessBuilder pb = new ProcessBuilder(c.fileName);
Process proc = null;
try {
proc = pb.start();
} catch (IOException ex) {
Logger.getLogger(clas.class.getName()).log(Level.SEVERE, null, ex);
}
Scanner in = new Scanner(proc.getInputStream());
PrintWriter out = null;
out = new PrintWriter(proc.getOutputStream());
while (in.hasNextLine()) {
System.out.println(in.nextLine());
out.println(1); // i don't want to give 1 untill the process need it !
out.flush();
}
out.close();