我需要我的Java控制台应用程序来执行以下操作:
到目前为止,我被困在1 ..似乎不可能让Java打开VIM!
这是我一直在摆弄的一些非功能性代码:
http://www.linglom.com/2007/06/06/how-to-run-command-line-or-execute-external-application-from-java
建议非常感谢
编辑
好的,以下将打开VIM但背景。有什么方法吗?
String[] command = {"/usr/bin/vim", "test.txt"};
Process vimProcess = Runtime.getRuntime().exec(command);
vimProcess.waitFor();
Process pr = Runtime.getRuntime().exec("gnome-terminal -e 'vim /tmp/tmpfile'");
int exitVal = pr.waitFor(); //check for the right exitVal
System.out.println(FileUtils.raedFileToString(new File("/tmp/tmpfile")));