반응형
public class Test{
public static void main(String[] args){
String[] command = {"/bin/sh","-c","실행시킬 쉘 스크립트"};
int i;
try{
Process ps = Runtime.getRuntime().exec(command);
ps.waitFor();
System.out.println(ps.exitValue());
ps.destroy();
}catch(Exception e){
e.printStackTrace();
}
}
}
public static void main(String[] args){
String[] command = {"/bin/sh","-c","실행시킬 쉘 스크립트"};
int i;
try{
Process ps = Runtime.getRuntime().exec(command);
ps.waitFor();
System.out.println(ps.exitValue());
ps.destroy();
}catch(Exception e){
e.printStackTrace();
}
}
}
[출처] JAVA에서 쉘스크립트 실행|작성자 세직사