0

I've recently started a project where I am required to start a external process from within my parent process. However, since the external process uses System.console(), it is unable to function properly as it is getting a null object in return. Both the external and parent applications are written in java and there is no chance that the external process can be modified in any way (as it is being produced by a third party)

Both the Input and Output streams of the process object are being handled and the stderr stream is being redirected to the output.

My question is: Is there a way to "emulate" a console so that the external sub-process's System.console() call returns a valid console object that is hooked to my primary (parent) application?

Code for process builder below:

final ProcessBuilder Builder = new ProcessBuilder("\"" + System.getProperty("java.home") + "\\bin\\java.exe\"", InitMemArg, MaxMemArg, "-jar", "\"" + MCServer.getName() + "\"");
Builder.redirectErrorStream(true);
4

1 回答 1

0

在您开始第 3 方进程之前,您似乎必须创建一个 Thread 来创建一个控制台类,该控制台作为控制台出现在第 3 方应用程序中。

此控制台还必须与您的 GUI 应用程序进行通信。

于 2013-01-03T19:53:45.510 回答