How to redirect System.out and System.err to Lanterna 3 Terminal?

88 views
Skip to first unread message

Joerg Junge

unread,
Jun 20, 2017, 1:12:54 PM6/20/17
to lanterna-discuss
Hello

I create executable jar for Windows and Unix (console only). I the case the user is double clicking the jar under windows (System.console() == null),
I want to present a Lanterna 3 Console Windows and the System,out and System.err should be redirected to the Lanterna Terminal.

Is there a included way in Lanterna 3 or do I have to implement a stream to character put method myself?

I'm using Lanterna 3 rc 1.

Cheers JJ


Martin Berglund

unread,
Jul 9, 2017, 8:58:48 AM7/9/17
to lanterna...@googlegroups.com
Hi JJ,
Do I understand you correctly if you want to be able to double-click on a jar file in Windows and open the SwingTerminalFrame? And then have System.out and System.err from the Java process go into the SwingTerminalFrame?

Thanks,
Martin

--
Det här meddelandet skickas till dig eftersom du prenumererar på gruppen "lanterna-discuss" i Google Grupper.
Om du vill sluta prenumerera på den här gruppen och inte längre få någon e-post från den skickar du ett e-postmeddelande till lanterna-discuss+unsubscribe@googlegroups.com.
Fler alternativ finns på https://groups.google.com/d/optout.

Leather Dog Muksihs

unread,
Sep 18, 2020, 4:51:24 PM9/18/20
to lanterna-discuss
Yes, I believe that is what is being asked.

I'm searching for the correct way to do this also.

And have the terminal with a white background. With automatic color switching between stderr and stdout...
Om du vill sluta prenumerera på den här gruppen och inte längre få någon e-post från den skickar du ett e-postmeddelande till lanterna...@googlegroups.com.

Martin Berglund

unread,
Oct 4, 2020, 12:24:46 AM10/4/20
to lanterna...@googlegroups.com
Ok, I think that's possible to do, but the library doesn't provide that functionality out of the box so to speak. You'll need to first figure out how to start from double-clicking on a -jar file. You can then redirect the stdout and stderr streams to custom code which inserts the output into something like a lanterna terminal emulator.

Regards,
Martin

Om du vill sluta prenumerera på den här gruppen och inte längre få någon e-post från den skickar du ett e-postmeddelande till lanterna-discu...@googlegroups.com.
Om du vill visa den här diskussionen på webben besöker du https://groups.google.com/d/msgid/lanterna-discuss/bfb3aa2f-64f7-4fce-969c-9e51e4cf4dffo%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages