![]() The methods that create processes may not work well for special processes on certain native platforms, such as native windowing processes, daemon processes, Win16/DOS processes on Microsoft Windows, or shell scripts.īy default, the created subprocess does not have its own terminal or console. The class Process provides methods for performing input from the process, performing output to the process, waiting for the process to complete, checking the exit status of the process, and destroying (killing) the process. The ProcessBuilder.start() and Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it. ![]() What you do with the output of the command executed is entirely up to you and the application you’re creating. Then you use the getInputStream() and getErrorStream() methods of the Process object to read the normal output of the command, and the error output of the command. Invoking the exec method returns a Process object for managing the subprocess. Basically, you use the exec method of the Runtime class to run the command as a separate process. It involves the use of two Java classes, the Runtime class and the Process class. Executing a system command is relatively simple – once you’ve seen it done the first time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |