java에서 여러 개의 셸을 실행하는 방법을 찾고있었습니다. I에 유래에서 이것을 발견하지만, 세션 당 하나의 명령 셸 실행 만하는 데 도움이 :자바에서 다중 명령 셸 실행
try {
// Execute command
String command = "ls -la";
StringBuffer ret=new StringBuffer();
Process p = Runtime.getRuntime().exec(command);
// Get the input stream and read from it
InputStream in = child.getInputStream();
int c;
while ((c = in.read()) != -1) {
ret.append((char)c);
}
in.close();
System.out.println(ret.toString());
} catch (IOException e) {
e.printStackTrace();
}
위의 코드를 사용하여 동일한 세션에서 여러 명령을 실행하는 어쨌든 거기를?
당신이 의미하는 어떤 세션? – adranale