I would like to be able to launch VI from within my Java program and wait for the user to quit VI before proceeding. Here\'s the code snippet that I have currently:
I'm not sure how to do it with commons-exec,
But standard Java should be something along the lines of...
String[] command = {"/usr/bin/vi", "test.txt"};
Process vimProcess = Runtime.getRuntime().exec(command);
vimProcess.waitFor();
This will cause the current thread to wait for the process to complete. You can also use vimProcess.getInputStream(), getOutputStream() and getErrorStream() to redirect those to log files or wherever you want it to go.
See here for more details. http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html
Hopefully this helps.