0

Is it possible to run subprocesses like Far/MidnightCommander (or other terminal app with ncurses/graphical-interface) from java application with ProcessBuilder or somehow other way?

Standart examples with ProcessBuilder works fine with something simple like ping

new ProcessBuilder().command("ping -n 4 google.com").start(); // :)

, but not worked at all with far

new ProcessBuilder().command("far").start(); // :(
4

1 回答 1

0

Yes.

These applications need access to a terminal device to work. If you started the java program from a terminal, you can use that same terminal by letting the new process inherit it:

new ProcessBuilder().inheritIO().command("top").start(); // :)

Otherwise, you need to start a new terminal emulator to run the program.

new ProcessBuilder().command("xterm", "top").start(); // :)
于 2020-08-10T11:29:39.370 回答