I have a console program built using the deadline clone, JLine and need to call a full editor from it to make editing easier. The java program will have to call 'vi' or VIM or notepad on windows and allow the user to interact with it. Then when it is closed, the process would end and control return to the java console program.
Currently, most of the research I see is based around Runtime.exec and calling Process.waitfor for it to return.
Now, this runs, but the terminal window is not showing vi and is blocking.
Has anyone called an external program from java and have it take control of the console like this? I want to be able to do this from a prompt. Assume 'prompt>' is my command line running jline.
here I can capture the command edit from JLine and process it to call
Process p = Runtime.getruntime().exec("vi blah.txt");
then I can call
which should block until my vi session comes back. And, while in vi, I can do all the normal things, before saving and coming back to my java console session.
Now, my question is this, Does Runtime work in this situation? Can I control the terminal like this? If not, I'm open to suggestions to something that will work.