suchen

Heim  >  Fragen und Antworten  >  Hauptteil

java.lang.Runtime.getRuntime().exec(cmd)命令中参数不能用空格怎么办?

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

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

迷茫迷茫2804 Tage vor1001

Antworte allen(2)Ich werde antworten

  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:56:01

    String[] cmd = new String[]{exe_path, video, host + ":" + port}

    Antwort
    0
  • 高洛峰

    高洛峰2017-04-18 10:56:01

    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();

    Antwort
    0
  • StornierenAntwort