java.lang.Runtime.getRuntime().exec(cmd)命令中参数不能用空格怎么办?
迷茫
迷茫 2017-04-18 10:54:01
0
2
997

项目中无法执行c程序,猜测是exec()函数的问题

String cmd= exe_path + " " +video + " " +host + ":" + port;
Process process = runtime.exec(cmd);

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

membalas semua(2)
伊谢尔伦
String[] cmd = new String[]{exe_path, video, host + ":" + port}
小葫芦
String[] cmd = {"/data/data/app_name/exename", "3" "ip:port"};
java.lang.ProcessBuilder builder = new java.lang.ProcessBuilder(cmd);
java.lang.Process process = builder.start();
int exitcode = process.waitFor();
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan