Question
2
Replies
120
Views
Ness Technologies
Posted: May 6, 2019
Last activity: May 6, 2019
Closed
not able to execute unix script from pega
Hi,
I am not able to execute below code as I wanted to execute shell script :
try{
new ProcessBuilder("/Additional_Products/BIX/bix.sh").start();
}
catch(java.io.IOException ioEx) {
throw new PRRuntimeException(ioEx);
I am getting PRRuntimeException. Can somebody help me in this regards.
Thanks in advance.
Below is the working example on windows, it can be adapted for unix as well.
Please try the same on Java before if you would like to troubleshoot. Once it works in Java it is bound to work in pega as well.
String[] command = {"C:/Program Files/Java/jdk1.8.0_202/bin/jmap.exe", "-dump:format=b,file=C:/Users/kumau1/Desktop/HeapTest/heapdump2.bin","21544"};
ProcessBuilder p = new ProcessBuilder(command);
oLog.error("Output of 1111 " + command + " is: ");
try{ Process p2 = p.start();
oLog.error("Output of 11112222 " + command + " is: ");
java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(p2.getInputStream()));
String line;
oLog.error("Output of running " + command + " is: ");
while ((line = br.readLine()) != null) {
oLog.error(line);
}
}
catch(Throwable t){
t.printStackTrace();
}