Running Linux Commands From BPEL Java Embed

1k Views Asked by At

I have a composite deployed on a Linux server and with a Java Embed Activity I am trying to run a Linux command. The composite completes successfully but It seems that the command was not executed because the file was not copied. Below is the following code used.

try{
    addAuditTrailEntry("Before execution");         
    Runtime.getRuntime().exec("cp /home/default/January.csv /home/default/January_copy.csv");
    addAuditTrailEntry("After execution");
}catch(Exception ex){
    addAuditTrailEntry("Fault Occurred");
}

Does anyone know if it is possible to execute Linux commands from a BPEL's Java Embed Activity?

1

There are 1 best solutions below

0
On

It's possible. The method that works for me is the three argument exec method.

Example: Runtime.getRuntime().exec("cp /home/default/January.csv /home/default/January_copy.csv",null,workingDir);