I'm trying to get the content of the console and append it to a JavaFX TextArea.
I've found various examples all around StackOverflow, but all of them use a similar code to this:
@FXML
public void initialize() throws IOException {
Console console = new Console();
PrintStream ps = new PrintStream(console, true);
System.setOut(ps);
System.setErr(ps);
System.err.flush();
System.out.flush();
}
The issue is that the first two lines don't seem to be anymore accepted in Java 9. For the first one, I've solved my problem like this:
Console console = new Console();
becomes...
Console console = System.console();
Still, the PrintStream constructor doesn't accept anymore a java.io.Console object as an input, but only...
Error:(124, 26) java: no suitable constructor found for PrintStream(java.io.Console,boolean) constructor java.io.PrintStream.PrintStream(boolean,java.io.OutputStream) is not applicable (argument mismatch; java.io.Console cannot be converted to boolean) constructor java.io.PrintStream.PrintStream(java.io.OutputStream,boolean) is not applicable (argument mismatch; java.io.Console cannot be converted to java.io.OutputStream) constructor java.io.PrintStream.PrintStream(java.lang.String,java.lang.String) is not applicable (argument mismatch; java.io.Console cannot be converted to java.lang.String) constructor java.io.PrintStream.PrintStream(java.io.File,java.lang.String) is not applicable (argument mismatch; java.io.Console cannot be converted to java.io.File)
Am I missing something?
For reference, I've used this question.