$PATH variable isn't inherited through getRuntime().exec

后端 未结 3 711
花落未央
花落未央 2020-12-11 20:25

I\'m trying to start a script by the following command in Java:

proc = Runtime.getRuntime().exec(cmd, null, fwrkDir);

The command, typed in

3条回答
  •  旧时难觅i
    2020-12-11 20:54

    proc = Runtime.getRuntime().exec(cmd, null, fwrkDir);
    

    should be

    proc = Runtime.getRuntime().exec(cmd, "PATH=$PATH:/android-sdk-linux_x86/platform-tools", fwrkDir);
    

提交回复
热议问题