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

后端 未结 3 710
花落未央
花落未央 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 21:12

    Note that the second parameter to the exec() call in your example is null. The second parameter is where you set the environment for the command you are executing. If you are using Java 6, consider using ProcessBuilder.

提交回复
热议问题