Question

How Do You Read System.out.println from Java Program Called By Pega CLI Invocation?

I have been able to successfully get my Java application to be called and run by Pega. I can also see the exit code in Pega from java's System.exit(int) method. I want to return a JSON String to Pega before the exit is invoked. Can you help me with how to do get the System.out.println(String) of Java to be consumed by Pega?

***Edited by Moderator Marissa to move from Pega Academy to Pega Support Community; update platform capability tags***

Comments

Keep up to date on this post and subscribe to comments

November 3, 2019 - 1:41am

I would still like to know how to solve this. Until I get some answer about it, I've changed my software so that my Java objects save a .json file to a location and then Pega uses a System.IO.Streamreader to open and read the file and then I use the JSON features of Pega to convert the string to data. This is a work around that does the job but I'd rather not have the extra steps of saving, opening and deleting files when I can just read the console output (assuming that's possible). Any help understanding how to read the console, Java's System.out.println(JSONString), would be much appreciated.