Where does Java's ProcessBuilder look to execute commands?

前端 未结 2 1932
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 19:32

When I execute a command using ProcessBuilder, how does it know where to look for that command? Using this hack/trick I\'ve modified my PATH variable (verified

2条回答
  •  感动是毒
    2020-12-11 20:21

    If you want to take control of finding commands, then, well, take control of finding commands. Don't let ProcessBuilder search. Use your own code to find what you want to run, and then put an absolute pathname into the parameter to ProcessBuilder.

提交回复
热议问题