0

Hello i have created a new terminal session using java(on mac) Runtime.getRuntime().exec() later on in my java program i want to get hold of the terminal that i had created earlier. Is there any way to do that?

Also how can be "ctrl+c" executed in terminal through java program

1 Answers1

1

Runtime.getRuntime().exec() returns a Process object, that you can stop if you want .

destroy() will stop the process

waitFor() will wait for the process to end

get Input/Error/Output Stream() methods, enable you to send data, and retrieve error output and standard output of the process.

Arnaud
  • 17,229
  • 3
  • 31
  • 44