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);