简体   繁体   中英

what is a “Valid System process” for mac and windows. (java ProcessBuilder)

I am trying to work out the semantics of using Java ProcessBuilder to call operating system processes and read this line out of the javadocs for the start command :

"This method checks that the command is a valid operating system command. Which commands are valid is system-dependent, but at the very least the command must be a non-empty list of non-null strings."

Tell me, What is considered a valid process for Mac and for Windows? Is it anything that can be found on the PATH variable?

Is it anything that can be found on the PATH variable?

Yes it is; although you can also specify the full path of the command if you like (such as "/bin/ls" ). Another test if of course to check if the file in question is a regular file and has execution permissions.

Note: this will launch a "real" process, it will not launch it via a command interpreter; as such don't attempt to use pipes, file globs, shell builtins etc: those are interpreted by sh / cmd .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM