Question
3
Replies
89
Views
Posted: October 15, 2019
Last activity: October 23, 2019
Closed
Solved
Running Java CLI From Pega
I'm still new to Pega and learning. I have a Java application that I wrote that takes command line arguments. Is there a way, other than building a UI and interrogating that UI, to run my java program from Pega? What I want to do is something like have Pega run a command such as: "c:\java-jar-location\java -jar com.mydomain.Class arg1 arg2...". How can I do this with Pega?
Assuming you just wanted to launch a process and not interrogate it, you would use the static method from .Net; Process.Start. You can add this to your Toolbox, by right-clicking on an empty area (I use the General section for these myself) and selecting "Choose items...". The select the "Pega Robot Static Members" tab. Next, select the "From Global Assembly Cache" radio button. From the "Assembly" combo box, select "System". Locate the "Process" node and select the "Start" method by clicking into the check box. Click "Ok". You can now drag this method out to your automation. When you choose an overload, select the appropriate one; which is normally the method taking a "fileName" and "arguments".