Error / Output Streams with the Current Java Process

I know that to use ErrorStream or OutputStream you do the following

 Process process = Runtime.getRuntime ().exec ("the command you want to execute"); OutputStream stdin = process.getOutputStream (); InputStream stderr = process.getErrorStream (); 

What if I don’t want to start a new process, I want to get the ErrorStream and OutputStream current application I'm working on. (Current process).

How to get it?

+4
source share
1 answer

You are using System.out and System.err .

+11
source

Source: https://habr.com/ru/post/1390235/


All Articles