62,620
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) throws Exception{
List<String> command = new ArrayList<String>();
command.add("C:\\Users\\18655\\Desktop\\sql\\sqlparser\\dist\\sqlparser.exe");
command.add("insert into node(id,name) values(13, luan);");
final Runtime runtime = Runtime.getRuntime();
Process process = null;
try {
process = new ProcessBuilder(command).start();
System.out.println(process.isAlive());
System.out.println(process);
int exitVal = process.waitFor(); //true
System.out.println(exitVal); //0
System.out.println(process.isAlive()); //false
}
catch(Exception e) {
System.out.println(e.getMessage());
}
}