I am trying to open a vi editor using Java code in an linux env (the java code is executed via shell script). The editor should open in foreground & become active terminal, while the java is should be running at Background.
I tried using both commands using :-
String []command = {"xterm", "vi", "/home/user/test.txt"}; Process pr = Runtime.getRuntime().exec(command);
Process p = new ProcessBuilder("vi", "/home/user/test35.txt").start();
In one of the above code, if check the ps -ef | grep vi, I am able to the process, but its running at background. I want to run it in foreground as an active terminal as user for his type the text into the editor. While the java will be running at the background. Any suggestion or snippet's.
I have referred this Open VIM with Java application , but still in vain.