Skip to content
Advertisement

How to redirect ProcessBuilder’s output to a string?

I am using the following code to start a process builder.I want to know how can I redirect its output to a String.

JavaScript

I tried using ByteArrayOutputStream but it didn’t seem to work.

Advertisement

Answer

Read from the InputStream. You can append the output to a StringBuilder:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement