In standard Java, Runtime.getRuntime() or new ProcessBuilder are available for use to call OS command. Until Pega 8.2, things were simple - we could write these in the activity directly. However, unfortunately starting with 8.3, these were banned to use in PRPC for security reasons (Java injection vulnerabilities). Prohibited code includes:
If you try it, PRPC throws an error both in design time and run time. For example, below code is to run calculator program on Windows and it was valid in 8.2. From 8.3 onwards, it won't even let you save the rule.
However, sometimes customer may still require such implementation per their business needs. Workaround is to to write a Java code outside of PRPC, package it to Java Archive (Jar), import it into Pega database, and call it from an activity. This way, you can still achieve the same.
Using Java IDE, write a Java program and compile it to make class files. Then package them up into a single Jar file.
From Dev Studio, using the regular Import tool, import the Jar file into Pega database. It goes to PR_ENGINECLASSES table in the rules schema.
Restart the application server so that your custom class in Jar gets loaded in the bootstrap process.
Create an activity and call its method.
I have documented How-to as attached. Hope this helps.