我正在尝试在java中创建一个启动外部文件的进程,该文件要求用户在执行时提供许多参数。
问题是如何确定过程是否要求参数
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();